Questions in the title. I've always wondered and failed to find out from the jQuery source. How this is done.
To reiterate. In jQuery: how does the "$" become a function e.g."$()" as well as an object "$."
I can create it one way OR the other like so...
var $ = function(){
return {each:function(){console.log("Word")}}
}
// $.each(); FAIL!
$().each(); // Word
var $ = {
each:function(){console.log("Word")}
}
$.each(); // Word
//$().each(); FAIL!