indexof starting from the right side of an array