Sobes.tech
Junior — Middle

Can you list the data types in JavaScript that are considered primitive types?

sobes.tech AI

Answer from AI

In JavaScript, primitive types are considered to be:

  • string — a string, for example, "hello"
  • number — a number, for example, 42 or 3.14
  • bigint — integers of arbitrary length, for example, 9007199254740991n
  • boolean — a logical type: true or false
  • undefined — the value of a variable that has not been initialized
  • null — a special value representing "no value"
  • symbol — a unique and immutable identifier

Primitives are stored directly in the stack and are passed by value, unlike objects, which are passed by reference.