Here you can find the source of equals(val)
'use strict';/*w w w . j av a2s. c om*/ String.prototype.equals = function (val) { var isEquals = false; if (this === val || this + '' === val + '') { isEquals = true; } return isEquals; };
String.prototype.equals = function (item) { return this == item; };
String.prototype.equals = function(str) { return this === str; };
String.prototype.equals = function(str){ return this.trim().toLowerCase() == str.trim().toLowerCase();