Primitive data types recap

Let's quickly summarize some of the main points discussed so far:

  • There are five primitive data types in JavaScript:
    • Number
    • String
    • Boolean
    • Undefined
    • Null
  • Everything that is not a primitive data type is an object
  • The primitive number data type can store positive and negative integers or floats, hexadecimal numbers, octal numbers, exponents, and the special numbers NaN, Infinity, and –Infinity
  • The string data type contains characters in quotes
  • The only values of the Boolean data type are true and false
  • The only value of the null data type is the value null
  • The only value of the undefined data type is the value undefined
  • All values become true when converted to a Boolean, with the exception of the six falsy values:
    • ""
    • null
    • undefined
    • 0

Get JavaScript : Object-Oriented Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.