I'm trying to pass a parameter to a callback function. Below is the snippet of my function:
let func = function(el, index){
if(el.id === myId) return index;
}
arr = [obj1, obj2, obj4, ...];
arr.filter(func);
Is there a way to successfully pass myId
to the callback in this scenario? Thanks for your help!