Javascript String indexOf(c, start=0)

Description

Javascript String indexOf(c, start=0)


String.prototype.indexOf = function(c, start=0){
  const reg = new RegExp(c)
  const match = this.slice(start).match(reg)
  return match ? match.index+start : -1
};



PreviousNext

Related