Answers for "Find index using arrow function"

0

Find index using arrow function

const fruits = ["apple", "banana", "cantaloupe", "blueberries", "grapefruit"];

const index = fruits.findIndex(fruit => fruit === "blueberries");

console.log(index); // 3
console.log(fruits[index]); // blueberries
Posted by: Guest on June-03-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language