It totaly makes sense to me to use it here. What would be the alternative? How can i generaly avoid to use them and most of all why is it bad according to jsLint to make us
you should define it with var $body, then it would be local in the scope of that function, without var it could be overwritten by everybody
(function($){
$(function(){
var $body = $('body'); //this is the local variable
$.each(somearray ,function(){ $body.dosomething() });
if (something){
$body.somethingelse();
}
});
}(jQuery));