// find all indexes in array that match value
let indices = array.map((e, i) => e === value ? i : '').filter(String)
function getAllIndexes(arr, val) {
var indexes = [], i;
for(i = 0; i < arr.length; i++)
if (arr[i] === val)
indexes.push(i);
return indexes;
}