wiki/content/20201116095124-object_fromentries.md

537 B

date id title
20201116 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