If we look at the latest jQuery source at http://code.jquery.com/jquery-latest.js , we will see the following:
var jQuery = function( selector, context ) {
My understanding of the new keyword in Javascript is, in essence, JavaScript passing an empty {} object to the function, and the function superimposes the contents on it through this.blah .
Also from my understanding, new is different from .call / .apply , etc. in that the return object also has a prototype set for the function prototype. Thus, the return value must have a prototype similar to jQuery.prototype.init.prototype (or jQuery.fn.init.prototype ). However, from what I see, its prototype is installed on jQuery.prototype , thus, all the commands available for working with the set.
Why is this? What am I missing in my understanding?
user53791
source share