Math library functions that return NaN
suggest changeA Math function returns NaN when an argument cannot be converted to a number. Values that do convert are used. Math.floor("1") is 1, and Math.floor(null) is 0. Math.floor("a") is NaN.
Math.floor("a")
The square root of a negative number returns NaN, because Math.sqrt does not support imaginary or complex numbers.
Math.sqrt(-1)
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents