Compare two string ignoring the case - Node.js String

Node.js examples for String:Case

Description

Compare two string ignoring the case

Demo Code


String.prototype.equalsIgnoreCase = function(str) {
  if (this == void 0) {throw new Error("Illegal argument error.");}
  if (str == null || typeof str == "undefined") {
    return false;
  }//w  ww  .j  av  a  2s.c om
  return this.toLowerCase() == str.toLowerCase();
}

Related Tutorials