profileRyan KesPGP keyI build stuffEmailGithubTwitterLast.fmMastodonMatrix

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

Footnotes