i know the difference between the find and for each methods
from point that find will return the element that match the condition
but i want to figure out the useful of using any of them if i use array.find()
to applay a specific function not only search for a specific value in an array

find method

type herlet g=[1,2,3,4,5,6,1,2,3,4,5,6]
let counter=0;
let idxArray=[];
g.find((el,ix,g)=>{
    if (el===3){
        counter++;
        idxArray.push(ix);}
})
console.log(idxArray);

for each method

let g=[1,2,3,4,5,6,1,2,3,4,5,6]
let counter=0;
let idxArray=[];
g.find((el,ix,g)=>{
    if (el===3){
        counter++;
        idxArray.push(ix);}
})
console.log(idxArray);