var hero = {
breed: "Turtle",
occupation: "Ninja",
'finger count': 3
};
hero.occupation; // "Ninja" - dot notation
hero["breed"]; // "Turtle" - square bracket notation
hero["finger count"]; // 3
var key = "occupation";
hero[key]; // "Ninja"
hero.height; // "undefined"
hero.name = "Michelangelo";
hero.name; // "Michelangelo"
hero["height"] = 1.5;
hero.height; // 1.5
var key = "occupation";
hero[key] = "Pizza eater";
hero.occupation; // "Pizza eater"
var original = { howmany: 1 };
var copy = original;
copy.howmany; // 1
copy.howmany = 100;
original.howmany; // 100
When you compare objects,
you'll get true
only if you compare
two references to the same object.
var fido = {breed: 'dog'};
var benji = {breed: 'dog'};
benji === fido // false
var mydog = benji;
mydog === benji // true
mydog === fido // false