📜  将循环放入数组 javascript 代码示例

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

代码示例2
function test() {
    var sub_array = [];
    var super_array = [];
    for (var i = 1; i <= 3; i++) {
        sub_array.push(i);
        super_array.push(sub_array.slice(0));
    }
    alert(super_array);
}