What will the console.log(NaN === NaN) statement output?

What will the console.log(NaN === NaN) statement output?

a) true
b) false
c) undefined
d) NaN

Answer:

b) false

Explanation:

In JavaScript, NaN (Not-a-Number) is a special value that represents an undefined or unrepresentable number. When comparing NaN with itself using ===, the result is false. This is because NaN is not considered equal to anything, even itself.

Reference:

JavaScript MCQ (Multiple-Choice Questions)

Leave a Comment

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

Scroll to Top