let that = {
listAll: [1, 2, 3]
};
let data = [4, 5, 6];
let mergedArray = that.listAll.concat(data);
console.log(mergedArray); // 输出: [1, 2, 3, 4, 5, 6]
console.log(that.listAll); // 输出: [1, 2, 3],原始数组没有改变

唯有美景,可以抚慰我的心灵!
本文介绍了如何在JavaScript中使用`concat`方法合并两个数组`that.listAll`和`data`,并指出`that.listAll`保持不变,只记录了合并后的结果。
let that = {
listAll: [1, 2, 3]
};
let data = [4, 5, 6];
let mergedArray = that.listAll.concat(data);
console.log(mergedArray); // 输出: [1, 2, 3, 4, 5, 6]
console.log(that.listAll); // 输出: [1, 2, 3],原始数组没有改变

唯有美景,可以抚慰我的心灵!
3517
1829
1402
5201

被折叠的 条评论
为什么被折叠?