function insert(arr, item, index) { // splice 会修改原数组 var newArr = [...arr] newArr.splice(index, 0, item) return newArr }