Below array is called Data, it's array of objects with keys like "marketValue"
Below array is called Columns, it's array of objects with each has Header (Pretty name for columns) and id (Ugly name for columns)
How to scroll through Data and update all ugly keys like this "marketValue" to "Market Value" using columns array?
This is how far I got, but it doesn't work, it returns undefined for every singe row:
let PrettyData = Data.map((row) =>
Object.entries(row).forEach(
(key) => {
let newKey = columns.filter((colRow) => colRow.id === key[0]);
let obj = {newKey: key[1]}
return obj;
}
)
);


forEachis not meant to return anything. In fact, it doesn't returnobj. If you're planning to alter therowobject, you should notmapit.mapmethod is meant to be used with areturnstatement.