0

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

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

console.log(index); // 3
console.log(fruits[index]); // blueberries

Hi, came by this example here and wanted to know is there a way to use this format but instead of === blueberries, do something like !== blueberries in order to return grapefruit, cantaloupe, apple, banana. Thanks

CerebralFart
  • 3,134
  • 5
  • 24
  • 27
soupyc123
  • 11
  • 2

0 Answers0