function remove(arr, item) { var o = item arr= arr.filter(function(c){ return c != o }) return arr } console.log(remove([1, 2, 3, 4, 2], 2))