wiki/content/20201116095124-object_fromentries.md

23 lines
539 B
Markdown
Raw Permalink Normal View History

2024-05-06 20:40:05 +00:00
---
2024-10-30 17:34:11 +00:00
date: 2020-11-16
2024-05-06 20:40:05 +00:00
id: 87eebd15-af30-482c-83be-d9f77ecf83d0
title: Object.fromEntries
---
# Given an [iterable](20201014092625-javascript_iterables) over \[key,value\] pairs, `Object.fromEntries()` creates an object. It does the opposite of [Object.entries](20201113102048-object_entries). See the proposal[^1] for more information.
# Syntax
``` javascript
console.log(
Object.fromEntries([
["foo", 1],
["bar", 2],
])
); // { foo: 1, bar: 2 }
```
# Footnotes
[^1]: <https://github.com/tc39/proposal-object-from-entries>