Creates an object from an array of key-value pairs (entries).

Type signature

(entries: [string, any][]) => object

Examples

fromEntries([
  ["a", 1],
  ["b", 2],
  ["c", 3],
]);
// ⇒ { a: 1, b: 2, c: 3 }
Try in REPL

Questions

  • How to create an object from an array of key-value pairs?
  • How to create an object from an array of entries?

TypeScript sourceJavaScript source