Primitive vs Reference
Last updated
Last updated
Undefined:
Only one value, undefined.
Null:
Only one value, null.
Booleans:
Two values: true and false.
Numbers:
One value for each number.
BigInts:
One value for every conceivable integer.
Strings:
One value for every conceivable string.
Symbols:
The size of a primitive value is fixed, therefore, JS stores the primitive value on the stack
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
One value for every function expression we execute.
Structural Type
Resource: