Skip to content

Instantly share code, notes, and snippets.

@0xgdr
Last active November 16, 2019 12:39
Show Gist options
  • Select an option

  • Save 0xgdr/a15564810ec28a5aef4ec6eff11f7753 to your computer and use it in GitHub Desktop.

Select an option

Save 0xgdr/a15564810ec28a5aef4ec6eff11f7753 to your computer and use it in GitHub Desktop.
JavaScript Objects :: 2016-04-10

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 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);

box.material = "Steel";

console.log(cb);

For more Javascript learning check out my CodePen JS collection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment