JavaScript Object.fromEntries() Explained

JavaScript Logo

Object.fromEntries() – Transforms a list of key-value pairs into an object.

๐Ÿ‘‰ Syntax

Object.fromEntries(iterable)

๐Ÿงช Example

const entries = [['a', 1], ['b', 2]];
console.log(Object.fromEntries(entries)); // { a: 1, b: 2 }

Comments