Page 1 of 1

Javascript Math library functions that return NaN

Posted: Sun Oct 20, 2019 2:39 am
by admin
Generally, Math functions that are given non-numeric arguments will return NaN.

Code: Select all

Math.floor("a")
The square root of a negative number returns NaN, because Math.sqrt does not support imaginary or complex numbers.

Code: Select all

Math.sqrt(-1)