JS: Object.fromEntries

JS: Object.fromEntries

New in ES2019.


Return a object with key value pairs from iterable iterable. The iterable must have pairs as element, such as nested array, or map. [see JS: the Map Object Tutorial]

[see JS: Iterable]

[see JS: List Properties]

const t1 = [["a", 3], ["b", 4]];
const t2 = Object.fromEntries(t1);

console.log ( t2 );
// {"a":3, "b":4};
Like it? Help me by telling your friends. Or, Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials