JavaScript Data Types Explained: Primitives, References, and Memory Internals
JavaScript categorizes all values into two broad groups: primitives, which are immutable and stored by value, and objects, which are mutable structures stored on the heap and accessed via pointer. The language uses a 'call-by-sharing' model, meaning object references are passed by value, so mutations to a shared object persist while local reassignments do not affect the original binding. JavaScript is both dynamically and weakly typed, resolving types at runtime and allowing implicit conversions between incompatible types. Engines like V8 embed type tags directly into the low bits of a value's machine-word representation, which powers operations like typeof. Special behaviors such as the Temporal Dead Zone for let and const, and the sentinel nature of undefined, add further nuance to how uninitialized or missing values are handled.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in