Finding the Index of a Substring inside a String

Learn how to find the index of any substring in a string.

The indexOf and the lastIndexOf methods

The indexOf and the lastIndexOf string methods return the first and last substring index respectively inside a string.

Get hands-on with 1400+ tech skills courses.