mozilla

Primitive

A primitive (primitive value, primitive data type) is data that is not an object and has no methods.

Most of the time, a primitive value is represented directly at the lowest level of the language implementation.

In JavaScript, there are 6 primitive data types:

All primitives are immutable (cannot be changed).

Primitive wrapper objects in JavaScript

Except for null and undefined, all primitive values have object equivalents that wrap around the primitive values:

  • String for the string primitive.
  • Number for the number primitive.
  • Boolean for the Boolean primitive.
  • Symbol for the Symbol primitive.

The wrapper's valueOf() method returns the primitive value.

Learn more

General knowledge

Document Tags and Contributors

Last updated by: stevemao,