:
JavaScript boolean, undefined, null, number, symbol, string . , .
, : ( ) , , , , . .
, , - .
, , , , .
:
var a = 1;
var b = a;
console.log(a, b);
a = 2;
console.log(a, b);
var obj_a = {attr: 1};
var obj_b = obj_a;
console.log(obj_a, obj_b);
obj_b.attr = 2;
console.log(obj_a, obj_b);
: immutable.js
Libraries, such as immutable.js, provide types that combine the properties of primitive types and objects: Types from immutable.js behave like regular objects if you do not modify them. When you change the property of an immutable object, a new object is created, and the change is visible only through this new object. The advantage is that you save space in memory, and you can quickly check the equality of objects by simply comparing their references. You get a set of types that behave like integers, but you can store more complex structures in them.
source
share