find() & findIndex() code example
Example 1: js find index in list
let myList = ['foo', 'bar', 'qux'];
myList.indexOf('bar'); // 1
Example 2: findindex js
// findIndex(callback fn)
// .... return index (when condition meets)
// .... return -1 (if condition not meets)
const array = [5, 12, 8, 130, 44];
/// it returns the index of number which satisfy the condition true
const index = array.findIndex((item)=> item>10); //1
/// now we can check what element at that index...
console.log(array[index]); // array[1]