Javascript Array contains(array)
Array.prototype.contains = function(array) { var arr1 = this.sort(); var arr2 = array.sort(); var i = arr1.length; if ( i < arr2.length ) { return false; }//from w w w.ja va 2 s . com while (i--) { if (arr1[i] === arr2[i]) { return true; } } return false; };
Array.prototype.contains = function (e) { return this.indexOf(e) > -1; };