find index of element of array that matches to a specific value js code example
Example 1: javascript find unique values in array
// usage example:
var myArray = ['a', 1, 'a', 2, '1'];
var unique = myArray.filter((v, i, a) => a.indexOf(v) === i);
// unique is ['a', 1, 2, '1']
Example 2: 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