Predict the output of the following javascript code
console.log(typeof NaN);
Quiz Explanation
In JavaScript, NaN
stands for "Not a Number", and it is a special value of the number data type. However, NaN
is considered a numeric data type, not a separate data type on its own.
So, when you use the typeof
operator with NaN
, it will return "number"
, indicating that NaN
is of the number data type.
Therefore, the output of the given code will be:
number