Nodejs Array Compare compare(other)

Here you can find the source of compare(other)

Method Source Code

Array.prototype.compare = function(other) {
  return this.join('') == other.join('');
};

Related

  1. compare(array)
    Array.prototype.compare = function (array) {
        if (!array)
            return false;
        if (this.length != array.length)
            return false;
        for (var i = 0; i < this.length; i++) {
            if (this[i] instanceof Array && array[i] instanceof Array) {
                if (!this[i].compare(array[i]))
                    return false;
    ...
    
  2. compare(array)
    Array.prototype.compare = function (array) {
        if (!array)
            return false;
        if (this.length != array.length)
            return false;
        for (var i = 0, l=this.length; i < l; i++) {
            if (this[i] instanceof Array && array[i] instanceof Array) {
                if (!this[i].compare(array[i]))
                    return false;
    ...
    
  3. compare(array)
    Array.prototype.compare = function (array) {
      if (!array)
        return false;
      if (this.length != array.length)
        return false;
      for (var i = 0; i < this.length; i++) {
        if (this[i] instanceof Array && array[i] instanceof Array) {
          if (!this[i].compare(array[i]))
            return false;
    ...
    
  4. compare(array)
    Array.prototype.compare = function (array) {
        if (!array)
            return false;
        if (this.length != array.length)
            return false;
        for (var i = 0; i < this.length; i++) {
            if (this[i] instanceof Array && array[i] instanceof Array) {
                if (!this[i].compare(array[i]))
                    return false;
    ...
    
  5. compare(array)
    Array.prototype.compare = function (array) {
      if (!array)
        return false;
      if (this.length != array.length)
        return false;
      for (var i = 0; i < this.length; i++) {
        if (this[i] instanceof Array && array[i] instanceof Array) {
          if (!this[i].compare(array[i]))
            return false;
    ...
    
  6. compare(secondArray, compareFunction)
    Array.prototype.compare = function(secondArray, compareFunction){
        if(this.length != secondArray.length){
            return false;
        for(var i = 0; i < this.length; i++){
            if(this[i] instanceof Array && secondArray instanceof Array){
                this[i].compare(secondArray[i]);
            }else if(this[i] instanceof Object && secondArray instanceof Object){
                if(!compareFunction(this[i], secondArray[i])){
    ...
    
  7. compare(testArr)
    Array.prototype.compare = function(testArr) {
        if (this.length != testArr.length) return false;
        for (var i = 0; i < testArr.length; i++) {
            if (this[i].compare) { 
                if (!this[i].compare(testArr[i])) return false;
            if (this[i] !== testArr[i]) return false;
        return true;
    ...
    
  8. compare(testArr)
    Array.prototype.compare = function(testArr) {
      if (this.length != testArr.length) return false;
      for (var i = 0; i < testArr.length; i++) {
        if (this[i].compare) { 
          if (!this[i].compare(testArr[i])) return false;
        };
        if (this[i] !== testArr[i]) return false;
      };
      return true;
    ...
    
  9. compareArray(array1)
    Array.prototype.compareArray = function(array1) {
      var array1 = array1;
      var array2 = this;
      if (array1.length === array2.length) {
        for (var i = 0; i < array1.length; i++) {
          for(var c = 0; c < array2.length; i++) {
            if (array1[i] === array2[c]) {
              return true;
      } else {
        return false;
      };