how to get the index of an array in javascript

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

var index_of_apple = list.indexOf("apple") // 0search = (arr, item) => { return arr.indexOf(item); }
Source

Also in JavaScript: