Answers for "js for get array index"

2

js for of array with index

for (const [index, value] of [1, 2, 3, 4, 5].entries()) {
  console.log(index, value);
}
Posted by: Guest on June-18-2021
5

js array get index

var fruits = ["Banana", "Orange", "Apple", "Mango"];
return fruits.indexOf("Apple"); // Returns 2
Posted by: Guest on July-02-2020
1

how to get the index of an array in javascript

search = (arr, item) => { return arr.indexOf(item); }
Posted by: Guest on April-06-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language