What does “NaN” mean in JavaScript?

Posted 3 years ago

What you declare a variable in Javascript it has an initial value of “undefined” until a value is set. When performing a mathematical equation on said variable you will be return “NaN” which stands for “Not a Number”.


var a; // undefined
var b;

var a + b; // NaN

var a = 10;
var b = 5;

var a + b; // 15