Everything except primitives is passed by reference.
Almost everything in JavaScript is an object. As Sirko said, objects are passed by reference.
Thus, functions / arrays / objects are passed by reference, regardless of whether you are talking about a root object attached to var, or you are talking about an object / method encoded 3 points in depth, or you are talking about an object in an array, as a property of an object, in an array of objects ...
source share