// example array
var arr = [1,2,3,4]
// Without touching prototype
function remove(arr, val) {
return arr.filter(function(e) { return e !== val })
}
//call like
remove(arr, 5)
//With prototype
Array.prototype.remove = function (val) {
return this.filter(function(e) {return e !== val})
}
// call like
arr.remove(1)