js check if string contains value code example
Example 1: string contains in javascript
const string = "foo";
const substring = "oo";
console.log(string.includes(substring));
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: js check if string contains character
"FooBar".includes("oo"); // true
"FooBar".includes("foo"); // false
"FooBar".includes("oo", 2); // false