1.向数组添加最后一项
原生方法
const list = []
const newList = [...list].push('last') // 为了不改变原数组
更加可读性的方法
const list = []
const newList = [...arr, 'last']
2.向数组添加第一项
原生方法
const list = []
const newList = [...list].unshift('first') // 为了不改变原数组
更加可读性的方法
const arr = []
const newArr = ['first', ...arr]