find string javascript code example
Example 1: find in string javascript
stringToBeSearched.search(stringToBeFound);
Example 2: js string search
var str = "This is a test sentence";
var hasTest = str.includes("test");
if(hasTest == true){
//do a thing
}
Example 3: string.find javascript
var index = string.indexOf(searchStr);
var index = string.search(searchStr);