gattsbr gattsbr - 4 months ago 8
Javascript Question

ReferenceError: 'number' is undefined

In my code I'm trying to explicitly assign the javascript value of NaN to a variable.

This is the mistake I make occasionally:

var myVar = number.NaN;

Answer

The answer to this is simple. It's not number.NaN but Number.NaN

var myVar = Number.NaN;