JavaScript String lastIndexOf() method

The JavaScript string lastIndexOf() method retrieves the position of a char value present in the given string from the last position. Note: It is similar to indexOf(). The only difference is that lastIndexOf() returns the last index of a match instead of the first. Syntax 1: string.lastIndexOf(char) Syntax 2: string.lastIndexOf(ch,index) Syntax 3: string.lastIndexOf(str) Syntax 4: … Read more