Built-in Functions
In short: JavaScript ships with a toolbox of functions available in
every file, with no import needed — Math.round, Math.max,
parseInt, isNaN, Number.isInteger, and many more. They cover
rounding, comparing, random numbers, and safely checking a value's shape.
Most behave exactly as the name suggests, but a few have a sharp edge
worth memorising, because they don't fail loudly when misused.

Rounding and comparing without writing your own logic
Math bundles the everyday numeric helpers:
Math.round rounds to the nearest whole number, Math.max/Math.min
take any number of arguments and return the largest/smallest. No loop, no
manual comparison — the toolbox already has these.
Reading numbers out of messy text
parseInt and parseFloat, from the type-casting lessons, live here too
— global functions, not tied to any object:
parseInt/parseFloat read the leading numeric part and stop at the
first character that doesn't fit. isNaN checks whether a value, after
being coerced to a number, comes out as NaN — "abc" * 2 already is
NaN, so this is true. Number.isInteger checks for a genuine whole
number, no coercion involved.
Two traps: empty Math.max(), and isNaN's coercion
Both functions have a documented, surprising edge case:
Math.max() with nothing to compare returns -Infinity (anything beats
"nothing"), and Math.min() returns Infinity for the same reason —
surprising if you expected 0 or an error. isNaN("hello") is true
because the global version coerces "hello" to a number first — which is
NaN — before checking. Number.isNaN("hello") does no coercion at all,
so a string is never NaN itself, and it correctly says false. Prefer
Number.isNaN when you want to know "is this value literally NaN,"
not "would this coerce to NaN."
Quick practice
What does Math.max(3, 9, 1) return?
What does Math.max() return, with no arguments at all?
Why does isNaN("hello") return true while Number.isNaN("hello") returns false?
