In Javascript using jQuery i can add scope to the function using Immediately Invoked Function Expression and pass the function jQuery, and name the parameter $
(function ( $ ) {
$.fn.greenify = function() {
this.css( "color", "green" );
return this;
};
}( jQuery ));
Similarly, we write document ready function as below
$(function() {
console.log( "ready!" );
// use $ variable here
});
Does that mean document ready function is already scoped?
Do i also need to pass the function jQuery, and name the parameter $ in document ready function? something like below
$(function ( $ ) {
console.log( "ready!" );
// use $ variable here
}( jQuery ));