Node.js examples for Object:Object Operation
Primitive vs. Objects
var a = 23;/*ww w. ja v a 2s . c o m*/ var b = a; // Now mutate var a: a = 46; console.log("A = " + a + " | B = " + b); var obj1 = { name: "John", age: 26 }; var obj2 = obj1; // Now mutate the age on Object 1: obj1.age = 30; console.log("Object 1 Age = " + obj1.age + " | Object 2 Age = " + obj2.age); // Functions var age = 27; var obj = { name: "Jonas", city: "Lisbon" }; // Now ue a function to mutate the object's data: function change(a, b) { a = 30, b.city = "San Francisco"; } change(age, obj); console.log("Age = " + age + " | City = " + obj.city);