function removeWithoutCopy(arr, item) {
for(var i=0;i<arr.length;i++)
{
if(arr[i]==item)
{
arr.splice(i,1);
i--;
}
}
return arr;
}
The core idea: loop traversal, if it is equal to item, delete itself. At the same time i–, i++ will run to the previous position in the for loop, because the previous array will move one place to the left as a whole.