find letter in string javascript 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: how to identify specific letter from a string in javascript

var str = "Hello world, welcome to the universe.";
var n = str.includes("world", 12);

Example 3: .index of javascript

let monTableau = ['un', 'deux','trois', 'quatre'] ;
console.log(monTableau.indexOf('trois')) ;