Define globals locally
JavaScript
$(function(){
function test(){
//global object
alert(location);
//local define global object
var loc = location;
alert(loc);
}
test();
}());
$(function(){
function test(){
//global object
alert(location);
//local define global object
var loc = location;
alert(loc);
}
test();
}());