题解 | #添加元素#
添加元素
http://www.nowcoder.com/practice/941bcfa5b87940869fda681c1597fd3a
function insert(arr, item, index) {
const newArr = []
for (let i = 0; i < arr.length; i++) {
if(i===index) {
newArr.push(item)
newArr.push(arr[i])
}else {
newArr.push(arr[i])
}
}
return newArr;
}

