Datatypes in Javascript – setting the record straight

It’s a question that often comes up and there are many places on the internet that give an inaccurate answer, so here’s the real-deal.

Javascript has three primitive datatypes:

  • number
  • string
  • boolean

There are another two special datatypes:

  • null
  • undefined

The others are variations of object:

  • object
  • function
  • array

See here for further reading.