Javascript String startsWith(start)

Description

Javascript String startsWith(start)


String.prototype.startsWith = function(start) {
    return this.length >= start.length && this.substring(0, start.length) === start;
}

Javascript String startsWith(start)

String.prototype.startsWith = function(start) {
  return this.indexOf(start) == 0;
};



PreviousNext

Related