contains substring javascript

JavaScript
var str = "We got a poop cleanup on isle 4.";
if(str.indexOf("poop") !== -1){
	alert("Not again");
}
//use indexOf (it returns position of substring or -1 if not found)var string = "foo",
    substring = "oo";

console.log(string.includes(substring));"FooBar".includes("oo"); // true

"FooBar".includes("foo"); // false

"FooBar".includes("oo", 2); // false
Source

Also in JavaScript: