lastIndexOf

Returns the position (in the first argument) of the last occurrence of the second parameter. Returns -1 if there is no match.

Category

String

Function syntax

lastIndexOf(<parameters>)

Parameter

Parameter Type
string String
specified value String

Signature and returned type

lastIndexOf(<string>,<string>)

Returns an integer.

Example

lastIndexOf("Hello, "l"))

Returns 3.

Explanation:

In “Hello”, the last occurrence of “l” is at position 3.

On this page

Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free
Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now