JavaScript Object.fromEntries() Method
The Object.fromEntries() static method builds an object from a list of [key, value] pairs, such as a Map or the result of Object.entries().
Description
The Object.fromEntries() static method is the reverse of Object.entries(): it turns an iterable of key-value pairs into an object. It converts a Map into a plain object, turns URLSearchParams or FormData into an object, and rebuilds an object after transforming its entries.
Each entry must be an object with a key at index 0 and a value at index 1, usually a two-element array; if the same key appears more than once, the last value wins. Keys are converted to strings, or kept as symbols.
Note that a URLSearchParams or FormData object with repeated keys, such as several checkboxes with the same name, only keeps the last value when converted this way. Use getAll() on the original object to read every value for a key.
Syntax
Object.fromEntries(iterable)Parameters
- iterableAn iterable of
[key, value]pairs, such as an array of pairs or aMap.
Return Value
A new object built from the pairs.
Example
Browser Support
The following information will show you the current browser support for the Object.fromEntries() method. Hover over a browser icon to see the version that first introduced support for this method.
Desktop





Tablets & Mobile





