Javascript Array equalTo(compareTo)

Description

Javascript Array equalTo(compareTo)



// ignore this. It simplifies determining array equality
Array.prototype.equalTo = function(compareTo) {
 if (this.length !== compareTo.length) {
  return false;/*from  ww  w.ja va  2 s . c om*/
 }
 for(var i = 0; i < compareTo.length; i++) {
  if (this[i] !== compareTo[i]) {
   return false;
  }
 }
 return true;
};



PreviousNext

Related