I am working on a textbook.
This is the question:
Define a function lastIndexOf, which, given an array and a value, returns the index of the last time the value occurs in the array. If the value never occurs, the function should return -1.
Then after try your function on the following:
console.log(lastIndexOf([ 0, 1, 4, 1, 2 ], 1), "=?", 3);
I know there is a lastindexof() method. I just don't know how to implement it in this function.
My question is, how should I tackle this?
I am a novice student, but how would you, with your experience programming, think about doing this? What would be your thought process? What should I know?