DEV Community

loading...

Discussion on: Daily Challenge #172 - Find All in an Array

Collapse
miteshkamat27 profile image
Mitesh Kamat

In JavaScript:
function find_all1(arr, n){
let arr1 = [];
arr.forEach((item,index) => {
item === n ? arr1.push(index): null;
});
console.log(arr1);
}

find_all1([6,9,3,4,3,82,11],3);