function findAllOccurrences(arr, target) { let res = [] let i = 0 for(let v of arr) { if (v == target) { res.push(i) } i++ } return res }