var a = 1; function foo(){ var a = 2; var innerTwo = new Function("console.log(a)"); innerTwo(); } foo();
let arr1 = [1,2,3,4,5];
for(let i = 0; i<arr1.length; i++){
arr1.splice(0,1);
}
console.log('结果:',arr1);
let arr2 = [1,2,3,4,5];
for(let i = 0; i<arr2.length; i++){
arr2.splice(i,1);
i=0;
}
console.log('结果:',arr2);