Array.prototype.contains = function (elem) { for (var i = 0; i < this.length; i++) { if (this[i] == elem) { return true; } } return false; } Array.prototype.indexOf = function(o){ for(var i = 0 ; i<this.length;i++){ if(this[i] == o){ return i; } return -1; } }; Array.prototype.delete = function(o){ var index = this.indexOf(o); if(index != -1){ this.splice(index,1) } return this; }