Javascript objects

Published in Code on Apr 9, 2015

An Object property defined with an outside variable stores a reference to the original variable, not a copy of the variable. (i.e., by reference).  So, changing the property value of the property changes the value to the outside variable.

//

Use bracket notation object["propertyName"]  to reference property names that contain spaces in them.

//

Use bracket notation to reference object properties using expressions.  //  object.["book" + counter] = name;

//

To delete to completely remove a property from an object. //   delete object.propertyName;

//

The "this" keyword always refers to the owner Object of the function in  which the "this" is used.

//

The .length property cannot be applied to an Object. You will need to enumerate the object instead.

// All objects inherit from their respective prototype (i.e. Array, String, Number).  Additionally, those types inherit from the generic Object prototype. Thus, all Objects are descendants from the generic Object prototype.