Skip to content

Instantly share code, notes, and snippets.

@dokluch
Created May 31, 2016 10:00
Show Gist options
  • Save dokluch/d9a577e152298b9bdc8aaad534aa5e81 to your computer and use it in GitHub Desktop.
Save dokluch/d9a577e152298b9bdc8aaad534aa5e81 to your computer and use it in GitHub Desktop.
Перегружаем оператор сравнения для прототипа Array
var a = [1,2,3]
var b = [1,2,3]
Array.prototype["=="] = function(operand){
for(var i = 0; i < this.length; i++){
if(this[i] != operand[i]) return false;
}
return true;
}
alert(a == b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment