Primitive vs Reference
7 Primitives (Data Types)
Undefined:
Only one value, undefined.
Null:
Only one value, null.
Booleans:
Two values: true and false.
Numbers:
One value for each floating point math number.
BigInts:
One value for every conceivable integer.
Strings:
One value for every conceivable string.
Symbols:
More on this later
The size of a primitive value is fixed, therefore, JS stores the primitive value on the stack
Objects (Reference Type)
One value for every object literal we execute
A non-data type
Structural Type
The size of a reference value is DYNAMIC so JS stores the reference value on the heap
Resource: https://www.javascripttutorial.net/javascript-primitive-vs-reference-values/
Functions
One value for every function expression we execute.
Structural Type
Last updated