JavaScript Objects

In this example we are storing the object's properties by value. What this means is that cb is stored in memory, when you change the value of box.material to Steel it doesn't change the value of cb. Both of the console.log(cb); will display cardboard as cb has stored the value cardboard in memory.

var box = {};

box.material = "Cardboard";

var cb = box.material;

console.log(cb); // Cardboard

box.material = "Steel";

console.log(cb); // Cardboard

For refernce see the Mozilla Docs and for more Javascript learning check out my CodePen JS collection.