Jonathan Snook demonstrates when JavaScript passes by reference or passes by value. Essentially, primitive types are passed by value, objects are passed by reference. Passing functions however, makes things look like a pass by value if the this
keyword is being used in the code. Snook offers workarounds to this by passing objects so that the context is correct, or using the call()
function to ensure the context is correct.
First in a series of talks from Douglas Crockford about the JavaScript language. These talks cover the JavaScript language, from the history, the language, advanced features, platforms, standards and programming style. Talks about inheritance, using functions to build objects, closures, as well as the basic JavaScript syntax. Also covers code conventions. JavaScript is a language that requires discipline.