Here you can find the source of hasItem(search)
/*/*w ww . ja v a 2 s . com*/ * This software called - np - is a lightwight MVP Framework for building web applications and * was developed by Christian Peters * * Copyright (C) 2016 Christian Peters * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Contact: Christian Peters <c.peters.eshop@gmail.com> */ /* Remove: indexOf is the correct call */ Array.prototype.hasItem = function (search) { var i, l; if( this instanceof Array ) { l = this.length; for (i=0; i<l; i++) { if(this[i] === search) { return i; } } return false; } else { return this; } };
Array.prototype.has = function(value) { for (var i = 0, l = this.length; i < l; ++i) { if (this[i] == value) return true; return false;
Array.prototype.has = function(value, defaultValue) { for (i = 0; i < this.length; i++) if (this[i].toLowerCase() == value) return this[i]; return defaultValue;
Array.prototype.hasContain = function(val){ for(var i = 0 ; i < this.length ; ++i){ if(this[i] == val) return true ; return false ;
Array.prototype.hasItem = function(e) for(i=0;i<this.length && this[i]!=e;i++); return i;
Array.prototype.hasItem = function(item) { return this.indexOf(item) < 0 ? true : false;