Searching a string

The includes function performs a case-sensitive search to determine whether a certain string appears within the string's character sequence.

Loading TypeScript...

If you need to perform a case insensitive search, convert the sentence and search query to the same case.

You can also provide an index to start searching from.

The indexOf function searches a string and returns the index of the first occurrence of the given string.

The lastIndexOf function returns the last occurrence of the given string.

Was this page helpful?