in JavaScript what is the word ‘NaN’ mean?


Not a Number.

if you type: js nan in google the first result is:

which tells you everything you need to know

as programmer, google and stackoverflow are you friends, use them :slight_smile:


NaN is a member of the Number class

 > typeof(NaN)
=> 'number'   

If we give JavaScript non-numeric gibberish it substitutes NaN as its best guess…

 > parseInt("n")
=> NaN

It gets confusing sometimes, but since this is a global property that only JavaScript ever has to deal with, we can set it aside as far as usage goes. We would never write:

let n = NaN;

In fact we never use it in any expressions. Just like undefined, it is a fallback for the interpreter when nothing else will do.

While you are looking up properties and functions, include isNaN() in your research.


‘Class’ is not the exact term in JavaScript, as previous to ES6 there were no classes, only prototypes. Because of their similarity to class based languages, constructor functions took on the alias of class. Every object in JS can trace its prototype chain up to the parent constructors which are the blueprints that object instances follow.

Objects are essentially data, and they fall into three main categories:

primitive wrappers; eg. numbers, strings, booleans, null, undefined
reference objects; eg. data containers such as objects and arrays
functions; eg. input, storage, retrieval, processing, and output

From a basic point of view, and going forward associate class with the object prototype a particular type of data inherits from.

Extra reading: JavaScript data types and data structures


JavaScript is a living language with new iterations over time adding to the existing core. Read up on the history of JS and you will come upon the term ECMAScript which is the language standard that JS adheres to. As such, ES and JS are interchangeable names. Up to around 2010 we had ES5 (ECMAScript version 5) and then came version 6, ES6.

Today the language has matured even more and ES8 is on the horizon. The learning environment you are in (on CC) supports both ES5 and ES6 (so long as your browser does). Features of the later versions (post ES5) may not be supported in some browsers. Most do support ES6+.

In the meantime, focus more on your lessons and less on asking trivial questions that a quick search would handle.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.