Day 2

I brought FlashCards to take notes so I have a little bit more to report on the blog.


– the magic keyword ‘this’.

– In one sentence, ‘this’ always refers to “at run time”, the left side of the dot, of the function where ‘this’ was invoked.

– Exceptions are when there is nothing to the left of the dot, ‘this’ refers to ‘window’

Other tips:

– the prototype chains. Pass by reference. Object.protoype is the top level and there is nothing above that.

–  _.uniq() might be a common question in interviews

– will return [object Object], [object Array], [object Arguments] depending on what parameters are being passed in

– is a really visualization cool tool to show how your js code is being parsed

– array.reverse()

– typeof n === ‘undefined’

– In underscore, most of the time, the iterator takes three parameters, i.e. _.iterator(value, key, collection). Notable exceptions are _.reduce(function(memo, value, key, collection){})

– git commit every 5 to 10 lines

– Array.isArray() is not always working depending on the environment

– _.delay() doesn’t have the ability to pass a context as a parameter

– apply() vs call()