JavaScript_Succinctly
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
That is: a complex value is equal to another complex value when both refer to the<br />
same object.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Due to the nature of complex objects and references, <strong>JavaScript</strong> objects have<br />
dynamic properties.<br />
<strong>JavaScript</strong> is mutable, which means that native objects and user-defined object<br />
properties can be manipulated at any time.<br />
Getting/setting/updating an object’s properties is done by using dot notation or<br />
bracket notation. Bracket notation is convenient when the name of the object<br />
property being manipulated is in the form of an expression (e.g.,<br />
Array['prototype']['join'].apply()).<br />
When referencing object properties, a lookup chain is used to first look at the<br />
object that was referenced for the property. If the property is not there, the<br />
property is looked for on the constructor function’s prototype property. If it’s not<br />
found there, because the prototype holds an object value and the value is created<br />
from the Object() constructor, the property is looked for on the Object()<br />
constructor’s prototype property (Object.prototype). If the property is not<br />
found there, then the property is determined to be undefined.<br />
The prototype lookup chain is how inheritance (aka prototypal inheritance) was<br />
design to be accomplished in <strong>JavaScript</strong>.<br />
Because of the object property lookup chain (aka prototypal inheritance), all<br />
objects inherit from Object() simply because the prototype property is, itself, an<br />
Object() object.<br />
<strong>JavaScript</strong> functions are first-class citizens: functions are objects with properties<br />
and values.<br />
The this keyword, when used inside a function, is a generic way to reference the<br />
object containing the function.<br />
The value of this is determined during run time based on the context in which the<br />
function is called.<br />
Used in the global scope, the this keyword refers to the global object.<br />
<strong>JavaScript</strong> uses functions as a way to create a unique scope.<br />
<strong>JavaScript</strong> provides the global scope, and it’s in this scope that all <strong>JavaScript</strong> code<br />
exists.<br />
142