uniapp数组合并函数使用几录

时间:2024-03-31 08:13:44

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],原始数组没有改变
在这里插入图片描述
唯有美景,可以抚慰我的心灵!