(function($) {
// plugin code
})(window.jQuery);
Seems this code almost the same effect, as:
(function($) {
// plugin code
})(jQuery);
Should I use window.jQuery
or jQuery
for function argument? Does it make sense?
Same for Zepto, I've seen lots of people use window.Zepto
in their plugins, but the code also works with just Zepto
.
There is no difference, window
is the super global object in client-side JavaScript, all the functions and variables that are defined in the global context are methods and properties of the window
object.