How to convert this two loops forEach into map function?
var storedNames = [1,2,3];
var mod = {id: 3, blocList: [{id:11}, {id:12}]};
storedNames.forEach((item: number) => {
if (item === mod.id) {
mod.blocList.forEach((bloc: Bloc) => {
storedNames.push(bloc.id);
});
}
});
The result will be: storedNames = [1, 2, 3, 11, 12]