How to search an array element starting from the end of the array JavaScript

1 Answer

0 votes
const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

const result = arr.findLast(i => i > 6)

console.log(result);
   
       
       
/*
run:
       
10
       
*/

 



answered Feb 10, 2024 by avibootz
...