#The Object Type
The object type can be used with both dot notation object.value
or bracket notation object['value']
. The dot notation is preferred because it’s shorter and easier to read but the bracket notation could be used if the key has special characters in it, for instance object['hello world!]
.
#On Arrays
An array is an object that hold values not particularly in named properties/keys, but rather in numerically indexed positions.
var arr = [ 'hello world', 42, true ];
arr[0]; // hello world
#This
binding
There are four rules for how to determine the this
binding depending on the call-site.
- Default binding – The catch-all rule. Standalone function invocation.
- Implicit binding
- Explicit binding
new
binding