1var email = "grepper@gmail.com";
2if(email.includes("@")){
3 console.log("Email is valid");
4}
5else{
6 console.log("Email is not valid");
7}
8// includes return boolean, if your string found => true else => false
1var str = "We got a poop cleanup on isle 4.";
2if(str.indexOf("poop") !== -1){
3 alert("Not again");
4}
5//use indexOf (it returns position of substring or -1 if not found)
1"FooBar".includes("oo"); // true
2
3"FooBar".includes("foo"); // false
4
5"FooBar".includes("oo", 2); // false
1var str = "We got a poop cleanup on isle 4.";
2if(str.indexOf("poop") !== -1){
3 alert("Not again");
4}
1if (your_string.indexOf('hello') > -1)
2{
3 alert("hello found inside your_string");
4}