Javascript String includes(string, index)

Description

Javascript String includes(string, index)


String.prototype.includes = function (string, index) {
 if (typeof string === 'object' && string instanceof RegExp) throw new TypeError("First argument to String.prototype.includes must not be a regular expression");
 return this.indexOf(string, index) !== -1;
};



PreviousNext

Related