//先用es6的方法深拷贝传入的数组,再使用unshift方法在数组前面添加元素 function prepend(arr, item) { let newArr=[...arr] newArr.unshift(item) return newArr }