Primitive Data Types in JavaScript

There are 7 primitive data types in JavaScript:

  • String
  • Number
  • BigInt
  • Boolean
  • Null
  • Undefined
  • Symbol

Examples

String


  const primitive = "hello world"
  

Number


  const primitive = 42
  

Boolean


  const primitive = true
  

Null


  const primitive = null
  

Undefined


  const primitive = undefined
  

BigInt


  const primitive = BigInt("9045141578140991")
  

Symbol


  const primitive = Symbol('prim')