1var list = ["apple","banana","orange"]
2
3var index_of_apple = list.indexOf("apple") // 0
1// for dictionary case use findIndex
2var imageList = [
3 {value: 100},
4 {value: 200},
5 {value: 300},
6 {value: 400},
7 {value: 500}
8];
9var index = imageList.findIndex(img => img.value === 200);
1var fruits = ["Banana", "Orange", "Apple", "Mango"];
2return fruits.indexOf("Apple"); // Returns 2
1fruits.push('Mango')
2// ["Strawberry", "Banana", "Mango"]
3
4let pos = fruits.indexOf('Banana')
5// 1
6