re: Similar yet different. So confusing VIEW POST

TOP OF THREAD FULL DISCUSSION
re: I might be wrong, but const a = {x: 1} is actually assigning a pointer to an object to a, so this: const a = {x: 1}; a = {x: 2}; can...

Referential transparency - means you can't reassign variable.

const a = { x:  1 };
const b = a;
a.x = 2;
a === b; //true, because it is the same reference

Immutability - means you can't mutate object.

let a = Object.freeze({x : 1})
a.x = 2;
a.x === 1; // true, because a is immutable
code of conduct - report abuse