Answers for "how to search for a particular word in a string in javascript"

3

if str contains jquery

if (str.indexOf("Yes") >= 0)
  
  //case insensitive version
  if (str.toLowerCase().indexOf("yes") >= 0)
Posted by: Guest on July-01-2020
4

js string search

var str = "This is a test sentence";
var hasTest = str.includes("test");

if(hasTest == true){
	//do a thing 
}
Posted by: Guest on November-19-2020

Code answers related to "how to search for a particular word in a string in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language