Javascript Array contains(val, expr)
Array.prototype.contains = (val, expr) => { if (!this || !this.length) return false; for (let i = 0; i < this.length; i++) { if (expr && expr(this[i], val)) return true; //from ww w . ja v a 2s .c om if (!expr && this[i] === val) return true; } return false; };