function a(){
var arr1 = [];
for(var i = 0; i < 10; i++){
(function(i){
arr1[i] = function (){
document.write(i + ' ');
}
}(i))
}
return arr1;
}
var myArr1 = a();
for(var j = 0; j < 10; j++){
myArr1[j]();
}
看不懂,自己去结合AOGO作用域链。或者评论秒回