调用更改函数之前更改了Javascript数组

时间:2020-07-14 20:33:50

标签: javascript multidimensional-array console.log sequential-workflow

var state是二维数组

var state = [
    ['-', '-', '-'],
    ['-', '-', '-'],
    ['-', '-', '-']
];

console.log (state)
state [0][1] = 'G'

问题是console.log(state)在应用更改(打印为'G'后)正在向控制台打印state

var state = [
        ['-','-','-'],
        ['-','-','-'],
        ['-','-','-']
    ];

  
console.log (state);

state [0][1] = 'G';

0 个答案:

没有答案