Answers for "a string contains a letter js"

2

how to check if a string contains a certain letter in js

// use the variable.includes() 
const myString = "hello world!"
if(myString.includes("hello")){
  // do something 
}else{
  //also do something
}
Posted by: Guest on April-24-2022
3

javascript string contains character

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

Code answers related to "a string contains a letter js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language