let arr = []; items.forEach(item => { arr.push({ ... }); }); return arr;
or…
return items.map(item => ({ ... }));
Guess which one MastoFE does?
@alex In defence of the first one it's often easier to read.
@valleyforge I think it’s harder. When I see let arr = [] I wonder “when is this going to be modified, and how?” Using a functional approach like map you don’t have to wonder.
let arr = []
map
QOTO: Question Others to Teach Ourselves An inclusive, Academic Freedom, instance All cultures welcome. Hate speech and harassment strictly forbidden.
@valleyforge I think it’s harder. When I see
let arr = []I wonder “when is this going to be modified, and how?” Using a functional approach likemapyou don’t have to wonder.