Javascript Array delSomeElement(x)
//second task// w w w. j a va2 s . co m Array.prototype.delSomeElement = function(x) { i = 0; while ( i <= (this.length - 1)){ if (this[i] === x){ delete this[i]; } i++; } return this; }; var myArray = [1, 2, 1, 4, 1, 3, 4, 1, 111, 3, 2, 1, "1"]; console.log(myArray.delSomeElement(1));