DEV Community

Discussion on: Introducing Object.fromEntries

Collapse
 
yuetsu profile image
yuetsu

Great write up & explanation, thank you! One possible typo — in your final code example, you say —

This means Object.fromEntries can cause you to drop information.

However, in the code example that follows, you have —

const arr = [['a', 1], ['a', 2], ['c', 3]]
const entries = Object.entries(arr)
// {a: 2, c: 3}

... shouldn't that be, on the 2nd line — const entries = Object.fromEntries(arr) ??

Thought you'd want to know. But this is great and I learned a lot from both this and your other guide on for...in (Objects) and for...of (Arrays). Keep up the great work!

Collapse
 
laurieontech profile image
Laurie

Thanks for catching that! I’ll take a look.