Favorites

JavaScript Object.entries() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Object.entries()
JavaScript Object Static methodThis method is supported by all modern browsers.
Updated 28th November 2026

The Object.entries() static method returns an array of an object's [key, value] pairs, which makes it easy to loop over or transform an object.

Description

The Object.entries() static method returns an array of the object's own enumerable [key, value] pairs, in the same order as a for...in loop. Combined with for...of and destructuring, it's the cleanest way to loop over an object.

It also pairs with Object.fromEntries() to transform objects: convert to entries, use array methods such as map() or filter(), then convert back.

Only the object's own enumerable string-keyed properties are included; inherited properties and symbol keys are left out. For arrays, the keys are index strings, so Object.entries(['a']) gives [['0', 'a']]. Maps already have their own entries() method, which returns an iterator.

Syntax

Object.entries(obj)

Parameters

  • objThe object to work with.

Return Value

An array of [key, value] pairs for the object's own enumerable string-keyed properties.

Example

const stock = { apples: 5, pears: 0, plums: 12 };
for (const [fruit, count] of Object.entries(stock)) {
  console.log(fruit, count);
}

const inStock = Object.fromEntries(Object.entries(stock).filter(([, n]) => n > 0));
console.log(inStock);

Browser Support

The following information will show you the current browser support for the Object.entries() method. Hover over a browser icon to see the version that first introduced support for this method.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee