DB
const fruits = ["apple", "banana", "cantaloupe", "blueberries", "grapefruit"]; const index = fruits.findIndex(fruit => fruit === "blueberries"); console.log(index); // 3 console.log(fruits[index]); // blueberries exemple from MDN
CommentThreadSep 8, 2018What's the best alternative to indexOf() for checking existence of element in an array?