📜  访问for循环外部的变量javascript代码示例

📅  最后修改于: 2022-03-11 15:02:31.790000             🧑  作者: Mango

代码示例1
var x = [];
var y = [1,2,3,4]// see the change here
    
var i;
for (i = 0; i < y.length; ++i) {
    x.push(y[i]); // push every element here
}
console.log(x);