JavaScript NaN’s full form is “Not-a-Number”. The global NaN
property is a value representing Not-A-Number.
Number.NaN
NaN
is a property of the global object. In other words, it is a variable in the global scope.
JavaScript NaN
Simple example code
<!DOCTYPE html>
<html>
<body>
<script>
let x = Number.NaN;
console.log(x)
let z = NaN;
console.log(z)
</script>
</body>
</html>
Output:

Standard built-in objects – NaN
function sanitise(x) {
if (isNaN(x)) {
return NaN;
}
return x;
}
console.log(sanitise('1'));
// Output: "1"
console.log(sanitise('NotANumber'));
// Output: NaN
Testing against NaN
NaN === NaN; // false
Number.NaN === NaN; // false
isNaN(NaN); // true
isNaN(Number.NaN); // true
Number.isNaN(NaN); // true
function valueIsNaN(v) { return v !== v; }
valueIsNaN(1); // false
valueIsNaN(NaN); // true
valueIsNaN(Number.NaN); // true
Do comment if you have any doubt or suggestions on this JS NaN topic.
Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.
OS: Windows 10
Code: HTML 5 Version

Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.