indexOf : indexOf() is used to find the index of an element. It return -1 if the element is not found. If the item is present more than once, it returns the position of the first occurrence. Case Sensitive: "A" and "a" are considered different values. const fruits = ["Apple","Orange","Banana","Papaya","Guava"] for(let a of fruits){ document.write("Index of "+ a+ " : "+fruits.indexOf(a)) docu
Array Search methods
Nanthini Ammu·Dev.to··1 min read
D
Continue reading on Dev.to
This article was sourced from Dev.to's RSS feed. Visit the original for the complete story.