wiki/content/20201116095124-object_fromentries.md

539 B

date id title
2020-11-16 87eebd15-af30-482c-83be-d9f77ecf83d0 Object.fromEntries

Given an iterable over [key,value] pairs, Object.fromEntries() creates an object. It does the opposite of Object.entries. See the proposal1 for more information.

Syntax

console.log(
  Object.fromEntries([
    ["foo", 1],
    ["bar", 2],
  ])
); // { foo: 1, bar: 2 }

Footnotes