URL: https://www.progressiverobot.com/js-includes-string-method/

Use the <^>includes()<^> method to search for a substring inside a string:

				
					
var word = "bravery";



console.log(word.includes(“rave”));



// true

				
			

Syntax

string illustration for: Syntax

This quick and easy way to check if one string contains another is very simple to implement. Just call the method with the substring you’re looking for as the argument:

				
					
myString.includes(subString);

				
			

Case-Sensitive

Remember that the comparison takes cases into consideration:

				
					
var greetings = “Hi Sammy ~”;



console.log(greetings.includes(“hi”));



// false