Answers for "how to find index of an element in a list in js"

19

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
1

how to find the index of an item in nodelist in js

let nodes = document.getElementsByTagName('*');
Array.prototype.indexOf.call(nodes, document.body);
Posted by: Guest on June-09-2021
7

js get index of item in array

array.indexOf("item");
Posted by: Guest on May-13-2020

Code answers related to "how to find index of an element in a list in js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language