Thats the way lastIndexOf works... The second parameter is an index from the end backwards, so you are looking for "planet" at the end of the string (-1 means it was not found)
If you omit the start param, then it default to the length of the string (in this case 43) so if you supply 43 it should start to make sense.
Davendra Jayasingam
Hi there,
idx returns -1, only when I set the from parameter in lastIndexOf.