Javascript String startsWith(str, ignoreCase)

Description

Javascript String startsWith(str, ignoreCase)


String.prototype.startsWith = function(str, ignoreCase) {
  return (ignoreCase ? this.toUpperCase() : this)
    .indexOf(ignoreCase ? str.toUpperCase() : str) == 0;
};



PreviousNext

Related