A visual breakdown of JavaScript data types, how they are structured, and what actually matters in real dev life. JavaScript types fall into two groups: primitive types and non-primitive (reference) types.
Primitive types
- String →
"Hello" - Number →
123,3.14 - Boolean →
true/false - Null → an intentional empty value
- Undefined → not yet assigned
- Symbol → unique, hidden identifiers
Non-primitive (reference) types
- Object →
{} - Array →
[] - Function →
function() {}
Value vs reference
Primitives are copied by value; objects are shared by reference.
let x = 5;
let y = x;
y = 10;
console.log(x); // 5
let obj1 = { name: "Ahmad" };
let obj2 = obj1;
obj2.name = "Jaradat";
console.log(obj1.name); // "Jaradat"
null vs undefined
undefinedis automatic: JavaScript sets it by default.nullis manual: you assign it on purpose.
let x; // undefined (declared, not assigned)
let y = null; // assigned as intentionally empty
console.log(typeof null); // "object"
console.log(typeof undefined); // "undefined"
console.log(null === undefined); // false
console.log(null == undefined); // true (loose equality!)






