Here you can find the source of isBlank()
function proxy(func, context, args) { return function () { return func.apply(context, args); }/* w w w . j a va 2 s. c o m*/ } Array.prototype.isBlank = function () { return !this.length; };
Array.prototype.is = function(that) { var i, len, ok = true; for (i = 0, len = this.length; i < len && ok; i++) { if (this[i] instanceof Array && that[i] instanceof Array) { ok = this[i].is(that[i]); } else { ok = this[i] === that[i]; return ok; };
function maxSubArray (array) { var maxSoFar = 0, maxSum = 0; if (array.isAllNegative()) { var maxNum = Number.NEGATIVE_INFINITY; for (var j = 0, jLen = array.length; j < jLen; j++) { if (array[j] > maxNum) { maxNum = array[j] return maxNum; for (var i = 0, len = array.length; i < len; i++) { maxSoFar += array[i]; if (maxSoFar < 0) { maxSoFar = 0; else if (maxSoFar > maxSum) { maxSum = maxSoFar; return maxSum; Array.prototype.isAllNegative = function () { for (var i = 0, len = this.length; i < len; i++) { if (this[i] >= 0) { return false; return true; var myArray = [-100,-2,-3,-4,-105,-104]; maxSubArray(myArray);
Array.isArray = Array.isArray || function (obj) { return {}.call(obj) === '[object Array]'; };
Array.prototype.isCharPresent = function(charSearch) { var arr = this; var result = []; var testingStr = ''; if (charSearch.length > 1) { return "You're searching for more than one char"; for (var i = 0; i < this.length; i++) { if (arr[i].indexOf(charSearch) === -1) { ...
Array.prototype.isDefined = function (key) { return this.filter(c => { if (key) return c[key]; return !!c; });
Array.prototype.isDistinct = function() { this.sort(); for (var i = 1; i < this.length; i++) { if (this[i - 1] == this[i]) return false; return true; };
Array.prototype.isInt = function (){ return this.filter(function(n){ return (typeof(n) === 'number') && (n%1 === 0)}) }; Array.prototype.even = function (){ return this.isInt().filter(function(n){ return n%2 === 0}) }; Array.prototype.odd = function (){ return this.isInt().filter(function(n){ return n%2 !== 0}) }; ...