// 数组
let nums = [1,2,3] //字面量
let arr = new Array(0,1,2,3,4,5) //实例Array
// 增加
// pusu方法 在数组末尾添加数据
// unshift方法 在数组头部添加数据
nums.push(4)
nums.unshift(0)
// 删除
// pop方法 在数组末尾删除数据
// shift方法 在数组头部删除数据
arr.pop()
arr.shift()
// 替换
// splice(start, num, value1, value2)方法
// start:开始的下标
// num:替换(删除)的个数,为0就不替换
// value:可取,没有参数时不发生改变,有值就添加参数
nums.splice(1, 2)
arr.splice(1, 2, 'a', 'b')
// 截取,返回的是一个新数组
// slice(start, end)
// start:开始的下标
// end:结束的下标
let newNums = nums.slice(1, 3)
let newArr = arr.slice(1, 3)
// join函数 指定的分隔符进行分隔,将数组转换成字符串
newNums.join(',')