Glossary
Primitive

Primitive

A primitive is the simplest JavaScript data type, representing fundamental values that do not encapsulate any object, method, or property.

While designing websites and applications, web developers engage with numerous data types, including text, numbers, variables, and true or false values. Primitives are the essential building blocks of JavaScript that empower developers to store and manipulate these data types efficiently. 

Unlike more complex data types, such as objects or arrays, primitives hold a single value and are immutable, meaning they can’t be altered once established. 

Here are the 8 primitive data types and their functions:

  • boolean – Renders “true” or “false” values
  • char – Renders single-character values
  • short – Renders values from -32768 to 32767
  • int – Renders values from -231 to 231-1
  • long – Renders values from -263 to -263-1
  • float – Renders fractions or numbers up to six or seven decimal places
  • double – Renders fractions or numbers up to 15 decimal places

Other glossary terms