Object.fromEntries
Given an iterable over [key,value] pairs, Object.fromEntries()
creates an object. It does the opposite of Object.entries.
Syntax
console.log(
Object.fromEntries([
["foo", 1],
["bar", 2],
])
) // { foo: 1, bar: 2 }
Related
- JavaScript Objects
- ES2019
- Proposal1