//1.pop()尾部删除
var arr =[1,2,3];
arr.pop();
console.log(arr) //输出[1,2]
//2.shift()头部删除
var arr =[1,2,3];
arr.shift();
console.log(arr)
//3.push()尾部添加
var arr = ['a','b','c'];
var box ='b';
arr.push(box);
console.log(arr)
//4.unshift()头部添加
var arr = ['a','b','c'];
var boy ='b'
arr.unshift(boy);
console.log(arr)
网友评论