Answers for "get the index of a value js"

18

how to find the index of a value in an array in javascript

var list = ["apple","banana","orange"]

var index_of_apple = list.indexOf("apple") // 0
Posted by: Guest on February-01-2020
0

javascrpt find index

const numbers = [2, 4, 5, 3, 8, 9, 11, 33, 44];
const findIndex = numbers.findIndex((number) => number == 5);
console.log(findIndex)
//Expected output: 2
Posted by: Guest on September-17-2021

Code answers related to "get the index of a value js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language