I have been struggling with this easy change. I basically have two arrays:
let apps = [{name: "Insights", id: "INS"}, {name: "Recruit", id: "REC"}];
let securityApps = ["bw", "INS"];
I am basically trying to filter down apps
based on the elements inside securityApps
The result I am wanting to achieve is:
[{name: "Insights", id: "INS"}];
(since INS
is what they have in common in terms of ID) but still pass in apps
variable
Here is what I have started:
apps.filter((app) => {
securityApps.forEach((sgApp) => {
if (app.id === sgApp){
return app;
}
})
});
apps
is later implemented as
apps.map(...