Строка JavaScript содержит
var string = "foo",
substring = "oo";
console.log(string.includes(substring));
Cautious Crane
var string = "foo",
substring = "oo";
console.log(string.includes(substring));
let text = "Hello world, welcome to the universe.";
text.includes("world"); // return true
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 str = "We got a poop cleanup on isle 4.";
if(str.indexOf("poop") !== -1){
alert("Not again");
}