Nodejs String Equal equals(val)

Here you can find the source of equals(val)

Method Source Code

'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;
};

Related

  1. equals(item)
    String.prototype.equals = function (item) {
      return this == item;
    };
    
  2. equals(str)
    String.prototype.equals = function(str) {
        return this === str;
    };
    
  3. equals(str)
    String.prototype.equals = function(str){
      return this.trim().toLowerCase() == str.trim().toLowerCase();