移除数组 arr 中的所有值与 item 相等的元素,直接在给定的 arr 数组上进行操作,并将结果返回
function removeWithoutCopy(arr, item) {
for(var index of arr){
if(arr[index] == item){
arr.splice(index,1)
}
}
return arr
}
for of是ES6提供的方法,部分低版本浏览器无法支持