Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

indexof js

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

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

console.log(index); // 3
console.log(fruits[index]); // blueberries
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #indexof #js
ADD COMMENT
Topic
Name
2+1 =