string.find js code example
Example 1: js string search
var str = "This is a test sentence";
var hasTest = str.includes("test");
if(hasTest == true){
//do a thing
}
Example 2: string.find javascript
var index = string.indexOf(searchStr);
var index = string.search(searchStr);
Example 3: indefOf
const beasts = ['ant', 'bison', 'camel', 'duck', 'bison'];
console.log(beasts.indexOf('bison'));
// expected output: 1