js 数据操作方法 concat() slice() splice()
1.concat() 方法
(1)基于当前数组中的所有项创建一个新数组;
var colors = ["red","blue","green"];
var colors2 = colors.concat("yellow",["black","brown"]);
console.log(colors); //'red', 'blue', 'green'
console.log(colors2); //'red', 'blue', 'green', 'yellow', 'black', 'brown'
原创
2020-06-21 23:59:51 ·
174 阅读 ·
0 评论