Nodejs Array Check is(that)

Here you can find the source of is(that)

Method Source Code

/**// w  w  w . j ava 2 s .  c  om
 * Verifies if two arrays contain identical elements.
 */
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;
};

Related

  1. isAllNegative()
    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);
    
  2. isArray(obj)
    Array.isArray = Array.isArray || function (obj) {
      return {}.call(obj) === '[object Array]';
    };
    
  3. isBlank()
    function proxy(func, context, args) {
        return function () {
            return func.apply(context, args);
    Array.prototype.isBlank = function () {
        return !this.length;
    };
    
  4. isCharPresent(charSearch)
    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) {
    ...