Concat in an empty array in Javascript

后端 未结 4 1182
再見小時候
再見小時候 2021-02-20 08:24

I was browsing through some code and I was wondering how this could be useful

grid.push([].concat(row));

In my understanding it is the same as<

4条回答
  •  南笙
    南笙 (楼主)
    2021-02-20 08:30

    var canEmptyArray = [];
    grid = [...(grid), ...(canEmptyArray), ...(row)];
    

    All arrays can be empty as long as it is in the array format

提交回复
热议问题