ECMAScript 6 introduced String.prototype.includes:
const string = "foo";
const substring = "oo";
console.log(string.includes(substring)); // true
stringVariable.includes("Your Text");
// Here's what the syntax looks like:
// string.includes(substring, fromIndex)
// Here's an example:
const bio = "I am a web developer";
console.log(bio.includes("web"));
// true
if (str.toLowerCase().indexOf("yes") >= 0)
ECMAScript 6 introduced String.prototype.includes:
const string = "foo";
const substring = "oo";
console.log(string.includes(substring)); // true
const string = "javascript";
const substring = "script";
console.log(string.includes(substring));
There is a String.prototype.includes in ES6:
"potato".includes("to")