Javascript String contains(obj)

Description

Javascript String contains(obj)


String.prototype.contains = function (obj) {
    return this.indexOf(obj) >= 0;
};

Javascript String contains(palavra)


String.prototype.contains = function (palavra) {
  let indice = this.trim().indexOf(palavra);
  return indice >= 0;
}



PreviousNext

Related