Primitives vs. Reference Types: Bugs from Hell

Jacob Lozano
2 min readDec 15, 2020

Primitives and Reference Types are two distinct methods of how variables are stored in memory. Sometimes its a reference to where they’re stored in memory (like a location) and sometimes they’re stored as a value.

This distinction in data types leads to difficult bugs because if you don’t know this distinction exists, the bug is completely hidden. The logic will be cogent, but how the logic is executed by JS will continue to be hidden.

Primitive types are: String, Number, Boolean, undefined, null, and symbol

--

--