The lastIndexOf() method of an array returns the last index at which a given element can be found in the array, or -1 if it does not exist. The array is searched backwards, starting at fromIndex.

    
    const animals = ['Bird', 'Tiger', 'Penguin', 'Bird'];

    const result = animals.lastIndexOf('Bird');
    console.log(result);
    // 3

    const result1 = animals.lastIndexOf('Tiger');
    console.log(result1);
    // 1