Answers for "is contains in js"

89

javascript string contains

var string = "foo",
    substring = "oo";

console.log(string.includes(substring));
Posted by: Guest on December-21-2019
3

javascript string contains

var email = "[email protected]";
if(email.includes("@")){
  console.log("Email is valid");
}
else{
  console.log("Email is not valid");
}
// includes return boolean, if your string found => true else => false
Posted by: Guest on June-19-2021
0

javascript string contains

const string = "foo",
 const substring = "oo";
  console.log(string.includes(substring));
Posted by: Guest on January-15-2022
0

js string contains

let example = "Example String!";
let ourSubstring = "Example";

if (example.indexOf(ourSubstring) != 0) {
	console.log("The word Example is in the string.");
} else {
	console.log("The word Example is not in the string.");
}
Posted by: Guest on October-12-2021
0

js string contains

let str = "Example String!";

/Example/.test(str);
Posted by: Guest on October-12-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language