To search for a string inside a string, there are several functions:
indexOf() will return the index of the first occurrence of searchString in the string. If searchString is not found, then -1 is returned.
Similarly, lastIndexOf() will return the index of the last occurrence of searchstring or -1 if not found.
includes( searchString, start )
includes() will return a boolean that tells whether searchString exists in the string, starting from index start (defaults to 0). This is better than indexOf() if you simply need to test for existence of a substring.
replace() will return a string that has all occurrences of substrings matching the RegExp regexp or stringsubstring with a string replacement or the returned value of replaceFunction.
Note that this does not modify the string in place, but returns the string with replacements.
replaceFunction can be used for conditional replacements for regular expression objects (i.e., with use with regexp).