It's pretty simple: Object.entries is supposed to produce and Array of key, value pairs.. As such, I would expected this code to destructure
[{
id: 1,
name: "christian"
},{
id : 2,
name: "bongiorno"
}].map(Object.entries).forEach(([k,v]) => console.log(`${k}: ${v}`));
into producing:
id:1 name:christian
id:2 name:bongiorno
But it doesn't. I get, instead:
id,1: name,christian
id,2: name,bongiorno
What did I miss?
.reduce((a,b) => a.concat(b),[])to flatten it. Looks better. Should I update the question ? provide an answer?