JavaScript typeof

In JavaScript there are 5 different data types that can contain values:

  • string
  • number
  • boolean
  • object
  • function

There are 6 types of objects:

  • Object
  • Date
  • Array
  • String
  • Number
  • Boolean

And 2 data types that cannot contain values:

  • null
  • undefined

JavaScript typeof

==============

typeof “John” // Returns “string”

typeof 3.14 // Returns “number”

typeof NaN // Returns “number”

typeof false // Returns “boolean”

Leave a Reply

Back To Top