I am debugging someone else\'s JavaScript code and a majority of the code is wrapped like this:
(function ($) {
//majority of code here...
})(jQuery);
>
var $ = "some value we don't care about";
// v=====normal plain old function
(function ($) {
// ^=======receives jQuery object as the $ parameter
//majority of code here, where $ === jQuery...
$('.myclass').do().crazy().things();
})(jQuery);
// ^=======immediately invoked, and passed the jQuery object
// out here, $ is undisturbed
alert( $ ); // "some value we don't care about"