Skip to main content

JavaScript Type System

8 lessonsAbout 48 minutesIntermediate

This part of the JavaScript Tutorial runs from JavaScript typeof through to JavaScript Primitives and References. There are 8 lessons here, and working through them takes about 48 minutes at a steady pace.

It follows on from JavaScript Classes, so finish that first if you have not already — the examples below assume you are comfortable with it.

Each lesson below says what it covers before you open it. Read them in order the first time; afterwards this page works as a index you can jump back into when you need to check one thing.

  1. 1JavaScript typeofThe typeof operator reports what kind of value you are holding.
  2. 2JavaScript Type ConversionType conversion changes a value from one type to another on purpose.
  3. 3JavaScript Type CoercionType coercion is JavaScript converting types automatically, whether you wanted it or not.
  4. 4JavaScript == vs ===The double equals converts types before comparing; the triple equals does not.
  5. 5JavaScript Truthy and FalsyEvery JavaScript value is either truthy or falsy when used as a condition.
  6. 6JavaScript null and undefinedundefined means a value was never set; null means it was set to nothing on purpose.
  7. 7JavaScript NaNNaN means Not a Number, and it is the result of a failed number operation.
  8. 8JavaScript Primitives and ReferencesPrimitives are copied by value and objects are copied by reference.