JSFiddle - React, Tailwind, and code Playground
by Liam Talbot
HTML
---<div id="includeThis">
11111
</div>-----
JavaScript
if (!String.prototype.includesThis) {
String.prototype.includesThis = function(search, start) {
'use strict';
if (typeof start !== 'number') {
start = 0;
}
if (start + search.length > this.length) {
return false;
} else {
return this.indexOf(search, start) !== -1;
}
};
}
document.getElementById("includeThis").innerHTML = "New text!".includes('texd');