How to use lastIndexOf to search an array from the end in JavaScript

1 Answer

0 votes
const arr = ["c++", "javascript", "php", "python", "go"];

let i = arr.lastIndexOf("php");

console.log(i);



/*
run:

2

*/

 



answered Aug 29, 2020 by avibootz
...