js array get index

JavaScript
const array1 = [5, 12, 8, 130, 44];
const search = element => element > 13;
console.log(array1.findIndex(search));
// expected output: 3

const array2 = [
  { id: 1, dev: false },
  { id: 2, dev: false },
  { id: 3, dev: true }
];
const search = obj => obj.dev === true;
console.log(array2.findIndex(search));
// expected output: 2var list = ["apple","banana","orange"]

var index_of_apple = list.indexOf("apple") // 0array.indexOf("item");var fruits = ["Banana", "Orange", "Apple", "Mango"];
return fruits.indexOf("Apple"); // Returns 2const beasts = ['ant', 'bison', 'camel', 'duck', 'bison'];

console.log(beasts.indexOf('bison'));
// expected output: 1        
            
        
     let ranks = [1, 5, 7, 8, 10, 7];
let index = ranks.findIndex(rank => rank === 7);
console.log(index);

Source

Also in JavaScript: