JavaScript Object.fromEntries() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Object

Definition

Object.fromEntries(iterable) builds a new object from a list of [key, value] pairs. It is the reverse of Object.entries() for plain objects.

The iterable can be an array of pairs, a Map, or any other iterable that yields two-item entries.

Syntax

Call Object.fromEntries() like this. Start with this line.

JavaScript
Object.fromEntries(iterable)
CallWhat it does
Object.fromEntries(iterable)Creates a new object from [key, value] pairs.

Built into JavaScript. Call on Object — no import required.

Library declarations
JavaScript
Object.fromEntries(iterable)
JavaScript
fromEntries(entries: Iterable<readonly any[]>): any;

Parameters

ParameterDescription
iterableRequired. An iterable of entries, where each entry is a [key, value] pair.

Return Value

Return ValueDescription
objectA new plain object with a property for each pair.

JavaScript Examples

Example 1 — Basic Use

Turn an array of pairs into a plain object.

JavaScript
var pairs = [
  ["name", "Ada"],
  ["role", "admin"]
];

console.log(JSON.stringify(Object.fromEntries(pairs)));
// {"name":"Ada","role":"admin"}
Try It Yourself

How It Works

  1. Prepare pairs. Each inner array is one key and one value.
  2. Build the object. fromEntries creates a new object from those pairs.
  3. Keys become properties. name and role are normal own properties.

Example 2 — Map to Object

Convert a Map into a plain object in one step.

JavaScript
var map = new Map([
  ["a", 1],
  ["b", 2]
]);

console.log(JSON.stringify(Object.fromEntries(map)));  // {"a":1,"b":2}
Try It Yourself

How It Works

  1. Start with a Map. A Map already stores entries as key/value pairs.
  2. Pass the Map. fromEntries reads those entries because a Map is iterable.
  3. Get a plain object. The result is a normal object you can JSON-stringify.

Example 3 — Filter Then Rebuild

Combine entries, filter, and fromEntries to make a smaller object.

JavaScript
var obj = { x: 1, y: 2, z: 3 };
var filtered = Object.fromEntries(
  Object.entries(obj).filter(function (pair) {
    return pair[1] > 1;
  })
);

console.log(JSON.stringify(filtered));  // {"y":2,"z":3}
Try It Yourself

How It Works

  1. To pairs. Object.entries(obj) gives every key and value.
  2. Keep some pairs. The filter keeps only values greater than 1.
  3. Back to an object. fromEntries rebuilds the object with y and z.

Browser & Runtime Support

Object.fromEntries() arrived in ES2019 and is Baseline Widely available in modern browsers and Node.js.

✓ Baseline · ES2019

Object.fromEntries()

Supported in Chrome 73+, Firefox 63+, Safari 12.1+, Edge 79+, and Node.js 12+. Use a polyfill only for very old engines.

96% Modern browser support
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
Object.fromEntries Excellent

Bottom line: Safe for modern web apps and current Node LTS. Pair it with Object.entries() for transform pipelines.

Frequently Asked Questions

It creates a new plain object from an iterable of [key, value] pairs, such as an array of pairs or a Map.
Yes for plain objects. Object.entries(obj) makes pairs, and Object.fromEntries(pairs) builds an object again.
Yes. A Map is iterable, so Object.fromEntries(map) turns it into a plain object.
The later pair overwrites the earlier one. No error is thrown.
No. It returns a new object. The original iterable is left alone.

Next: getOwnPropertyDescriptor()

Read one property's descriptor flags.

getOwnPropertyDescriptor() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful