From Mozilla: An overview of the object-oriented capabilities of JavaScript. This covers OO concepts of classes and objects, instances, abstraction, encapsulation and polymorphism as done in JavaScript with functions and prototypal inheritance.
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.