// demonstrates short hand way to assign data members to an object var foo = { val1: function() {}, val2: null, val3: 13, val4: new Object() }; // data members are public foo.val3 = 33; // same 33 output on both console.log(foo.val3); console.log(foo['val3']); var bar = new Object(); bar.foo = function() {}; bar.foo.val1 = 99; // will get overwritten bar.foo = { val2: 3.14, val3: 121 }; console.log(bar.foo['val2']);