While I appreciate the functionality of this map, I can't help but wonder if it's considered poor practice to use return on every iteration of a loop.
Would using return in every iteration be deemed as bad practice?
Thank you
const array = [
["Header 1", "Header 2"],
[1, 2],
[3, 4],
];
const mappedArray = array.map((row, index) => {
if (index === 0) {
return row;
} else {
return row.map((value) => value * 2);
}
});
I have attempted to research this issue but unfortunately came up empty-handed.