The lastIndexOf() of a String searches the string and returns the index of the last occurrence of the specified substring. It takes an optional starting position and returns the last occurrence of the specified substring at an index less than or equal to the specified number.

    
    const sentence = "I think Ruth's dog is cuter than your dog!";

    const searchTerm = 'dog';

    const sentenceLastIndexDog =  sentence.lastIndexOf(searchTerm);

    console.log(sentenceLastIndexDog)
    // 38