In the past few days, I have been developing a JavaScript library similar to Underscore.js and JQuery. In both libraries, they use an object that can take parameters, but can also have methods called on it: $ ("param"). Method (); or _ ("param"). method ();
I read the source code in both of these libraries, trying to figure out how they implement such a thing, but couldn't figure it out. I do not know the name of this type of closure, so I could not find it.
Any help would be appreciated, I'm just trying to figure out how I can implement an object of this type in my library.
source
share