xxxxxxxxxx
//removing the first match of 5 from [2,5,9,1,5,8,5])
function removeItemOnce(arr, value) {
var index = arr.indexOf(value);
if (index > -1) {
arr.splice(index, 1);
}
return arr;
}
// Usage
console.log(removeItemOnce([2,5,9,1,5,8,5], 5))