I've been developing a JavaScript library similar to Underscore.js and Jquery in the past few days. In both of those libraries they use an object which can accept parameters but can also have methods called on it: $("param").method(); or _("param").method();
I've been reading through the source code on both of these libraries trying to understand how they are implementing such a thing but have been unable to figure it out. I do not know the name of this type of closure so I've been unable to search for it.
Any help would be appreciated, I'm just trying to figure out how I can implement an object of this type into my library.