includes()
The includes() method performs a case-sensitive search to determine whether one string may be found within another string, returning true or false as appropriate.
const myString = "Philippines";
const mySubstring = "pine";
myString.includes(mySubstring); // true
If you want to do a case-insensitve search you'll need to uppercase (or lowercase) both strings before searching.
const myString = "PhiliPPines";
const mySubstring = "PINE";
myString.toUpperCase().includes(mySubstring.toUpperCase()); // true
indexOf()
The indexOf() method searches a string, and returns the index of the first occurrence of the specified substring or -1 if not found.
indexOf() is also case-sensitive so for case-insensitve searches you need to uppercase or lowercase both strings before testing as described above.
const myString = "Philippines";
const mySubstring = "pine";
myString.indexOf(mySubstring) !== -1; // true