What is the output of the following code: console.log(typeof NaN);?

What is the output of the following code: console.log(typeof NaN);?

a) "undefined"
b) "number"
c) "object"
d) "NaN"

Answer:

b) "number"

Explanation:

In JavaScript, NaN stands for “Not-a-Number”, but it is still considered a numeric value. When checking the type of NaN using typeof, the result is "number".

Reference:

JavaScript MCQ (Multiple-Choice Questions)

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top