I was wondering in this example if x would become a global variable as if was not declared inside the local function? Will javascript exit the local function, search until it doesnt find an x, and then implicitly create a global x?
function f(){
var ar=[],i;
for(i=0;i<3;i++){
//this time instead of passing i, the funciton has a local value called
x
arr[i]=(function(x)){
return function(){
return x;
};
}(i));
}
return arr;
}