Here you can find the source of none(p)
//same as:/*from w w w . j a v a2 s.c o m*/ // Array.prototype.all = function (p) { // return this.filter(p).length == this.length; // }; // [-1, 2, 3].none(isLessThanZero) => false // [-1, -2, -3].none(isGreaterThanZero) => true // *** YOUR CODE HERE *** Array.prototype.none = function(p) { var count = 0 for (var i = 0; i < this.length; i++) { currentIndex = this[i] if (p(currentIndex) !== true) { count += 1 }; } if (count !== this.length) { return false } return true }; // OR // Array.prototype.none = function (p) { // return this.filter(p).length == 0; // };
Array.prototype.none = function (p) { var count = 0 for (var i = 0 ; i < this.length ; i++) { currentIndex = this[i] if (p(currentIndex) !== true) { count +=1 }; if (count !== this.length) { ...
Array.prototype.none = function (p) { if(this.length == 0){ return true; for(var i=0;i<this.length;i++){ if(p(this[i]) === true){ break; else ...
Array.prototype.none = function (p) { for(var i = 0; i < this.length; i++){ if(p(this[i])) return false; return true; };
Array.prototype.none = function (p) { return this.filter(p).length == 0; };
Array.prototype.none = function (p) { for (i = 0; i < this.length; i++) if (p(this[i])) return false; return true; };