- comments: // or "/*" but latter is dangerous
- there are a whole bunch of reserved words that are not actually used in the language, and you can't use them for varibales or names or attributes.
- hasOwnProperty is useful in for loops when going over an objects properties
- === is the equality operator (what about == ?)
- undefined value means a variable has not be assigned something. It's its own type. On the other hand a null value is explicitly assigned and means "no value". It's an object type.
- variables have no dashes.
- Function objects have a prototype attribute (different from hidden link to prototype)
- Pass as many parameters as you want. Extra ones are ignored, missing ones become undefined. All of them are included in the arguments hidden parameter.
- When function is invoked, "this" can vary depending on how function was invoked.
method invocation, when function is object property => "this" is the object itself.
plain function invocation => "this" is the global object (in a browser, this is window)
constructor invocation, new Blah() => "this" is a new object that's created for the invocation, return value is "this", unless it's another object (can't be a number or string)
- apply invocation, method on Function object, let's you specify "this" and arguments directly.
- Arrays are like objects but not quite. They have an extra length property.
- You can assign to "length" to chop off the end of an array.
- append to an array by using the push method, or by assign to array[length].
- push will append one item to the end of the array.
- concat does the same, but if supplied with an array, will append each item one at a time.
- surgery on an array can be done with splice. splice(index, length, items_to_add)
- I don't think I understand the g flag