JavaScript

How to use Object.fromEntries?

Medium
2
Added
Transforms list of key-value pairs into object (reverse of Object.entries).

Solution Code

JavaScript
const arr = [['a', 1], ['b', 2]];
Object.fromEntries(arr); // {a:1, b:2}
Explanation
Useful for converting query parameters or Map to object.

Guided Hints

Combine with URLSearchParams
Type limitations