How to search array for an element starting at the end and returns its position in JavaScript

1 Answer

0 votes
const marks = [78, 92, 100, 86, 100, 94];
 
const index = marks.lastIndexOf(100);
 
console.log(index);
 
 
 
/*
 
run:
 
4
 
*/

 



answered Apr 5, 2017 by avibootz
edited Feb 10, 2024 by avibootz
...