Choose where you’d like to start

lastIndexOf()

Overview

The lastIndexOf() function takes listVariable and searchElement as arguments. It returns the last occurrence index of searchElement in listVariable.

If searchElement is not found in listVariable, the function will return -1.

Note: Index starts from 0.

Return Type

  • Number

Syntax

<variable> = <listVariable>.lastIndexOf( <searchElement> );
ParameterDescriptionData type
<variable>Variable which will contain the returned index number.NUMBER
<listVariable>The list variable from which the index number of the element will be returned.LIST
<searchElement>The element whose last occurrence will be checked in the list.AS APPLICABLE

Examples

listVar = {"Creator", "CRM", "Projects"};
lastIndex = listVar.lastIndexOf("Creator");        //returns 0

Get Started Now

Execute