1//primitive = {STRING, NUMBER, BOOLEAN, SYMBBOL, UNDEFIEND, NULL}
2//non-primitive = {ARRAY, OBJECT, FUNCTION}
3
4//primitive is always copied by VALUE
5var a = 1;
6var b = a;
7 //console.log(a , b) = 1 , 1
8a = 3;
9console.log(a) //3
10console.log(b) // still 1 and not 3 (always copied by value only)
11
12
13//non-primitive is always copied by REFERENCE
14var x = {name : "Jscript"};
15var y = x;
16 //console.log(x , y) TWICE = Object { name: "Jscript" }
17x.name = "Js";
18console.log(x) //Js
19console.log(y) //Js {copied by reference} like pointers in C lang