Friday, 15 June 2012

javascript - How does jQuery makes the jQuery object both a function and an object property? -


I have long been wondering how jQuery can be both a function and an object property.

You can use it as a function, jQuery (...) and you can use it as a property like jQuery.ajax (...)

How can you get such a thing in?

The functions are objects in JavaScript I, you can create your main function

  var $ = function ({warning ('watt'); }  

and then expand it

  $ FadeTo = function () {warning ('fadeto'); }  

No comments:

Post a Comment