Nodejs Array Equal Check isEqual(a)

Here you can find the source of isEqual(a)

Method Source Code

Array.prototype.isEqual = function(a){
  if(this.length!=a.length) return false;
  for(var i=0;i<this.length;i++){
    if(this[i] instanceof Array){
      if(!(a[i] instanceof Array)) return false;
      if(!this[i].isEqual(a[i])) return false;
    }else{/*from  www .j  a  v a 2 s.c o  m*/
      if(this[i]!=a[i]) return false;
    }
  }
  return true;
}

Related

  1. isEqual(arr)
    const a = [1, 2, 3];
    const b = [1, 2, 3];
    Array.prototype.isEqual = function (arr) {
      function check(arr1, arr2) {
        for (let i = 0, len = arr1.length; i < len; i++) {
          const bool = arr2.some(function (item) {
            return Object.is(arr1[i], item);
          });
          if (!bool) return false;
    ...
    
  2. isEqual(target)
    "use strict";
    Array.prototype.isEqual = function(target){
      if (this == target) return true;
      if (this == null || target == null) return false;
      if (this.length != target.length) return false;
      for(var i in this){
        if (
          (this[i] !== target[i]) &&
          (typeof this[i].isEqual != "function" ||
    ...