I noticed that in the jQuery core, one of the two arguments passed in is undefined.
(function( window, undefined ) {
// Use the correct document accordingly with window argument (sandbox)
var document = window.document;
var jQuery = (function() {
// ...defintion of the rest of the core...
window.jQuery = window.$ = jQuery;
})(window);
Can anyone explain why the second argument is undefined?
Thanks in advance!
In jQuery, the $ sign is just an alias to jQuery() , then an alias for a function. This page reports: Basic syntax is: $(selector).action() A dollar sign to define jQuery. A (selector) to "query (or find)" HTML elements.
$ is a short form of jQuery function. $() = jQuery() = window. $() = window. jQuery() $()/jQuery() is a selector function that selects DOM elements.
The jQuery library provides the jQuery function, which lets you select elements using CSS selectors.
on() is a built-in method in jQuery. It is used to assign one (or more than one) event handler to selected elements.
Undefined is a type but is also a global variable.
You can have a module that overwrites the value of undefined by doing undefined = whatever
.
jQuery uses a immediate function to scope window and undefined.
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/undefined
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With