Skip to content

Instantly share code, notes, and snippets.

@nola
Last active December 29, 2015 14:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nola/7687057 to your computer and use it in GitHub Desktop.
Save nola/7687057 to your computer and use it in GitHub Desktop.
The following example creates myHonda with three properties. Note that the engine property is also an object with its own properties.
var myHonda = {color: "red", wheels: 4, engine: {cylinders: 4, size: 2.2}};
//console edits and results
myHonda.color
"red"
myHonda.engine
Object {cylinders: 4, size: 2.2}
myHonda.engine.size
2.2
myHonda.engine.size = "3.3"
"3.3"
myHonda.engine.size
"3.3"
if(myHonda.engine.size === "5.0"){myHonda.engine.size = "6.0"}
"6.0"
myHonda.engine.size
"6.0"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment