Built-in Functions
Built-in functions and methods are reusable operations supplied by the language or its environment. Each has a contract for inputs, outputs and side effects.
Choose an operation because you understand its behavior, not because its name sounds close.
See the mechanism
" Quiet mornings "Follow one example
trim returns a new string; it does not mutate the original title. Reading title.length still includes the surrounding spaces. Math.ceil rounds upward, so 3.2 becomes 4. console.log is an environment-provided output facility. Consult the contract before assuming any method mutates its input or has the same rounding behavior as another.
Predict, change and check
Predict: Would title.trim() alone permanently remove spaces from title?
Test your explanation: Print title surrounded by brackets before and after trim. Store the returned string to keep the cleaned result.
The tasks below ask you to explain that result and apply the idea to different inputs.
Apply and distinguish
Know the global function's conversion policy
Built-in global functions such as parseInt, parseFloat and Number conversion helpers have different contracts. Parsing a numeric prefix is different from validating an entire numeric field. Number.isNaN does not coerce its input, while the global isNaN does.
encodeURIComponent is useful for a single URI component, not as a universal encoder for every assembled URL. Use URL and URLSearchParams for a browser URL boundary when appropriate. Avoid eval as a way to parse user-supplied data: JSON.parse is a data parser, and even its successful result still needs application validation.
Check your understanding: State the input contract, identify the operation that changes the result, and give one boundary input that would distinguish the correct rule from the mistake described above.