Is it possible somehow to use the lastIndexOf method to get the value of a variable in an array of array? For example if I had
[[1,2,3,4],[4,6,4,7,5], [5,7,4,6,3], [6,2,5,4,3]]
and I wanted to find the index of the last array where [1] was 2? In the above I would expect the answer to be 3 as the third array has [1] equal to 2.
I can see how I can make this work with nested loops or array methods but just wondered if there's some syntax I'm not aware of. Cheers
.findLastIndex()that would accept a function so you can test the elements against an arbitrary set of rules. You can only do this by hand.forloop from the endfor(let i = arr.length -1; i >= 0; i--)andbreakwhen a match is found