Object.entries
Returns an array of a given object's own enumerable string-keyed property key-value pairs
Syntax
Object.entries(obj)Parameters
| Parameter | Type | Description |
|---|---|---|
| obj | object | The object whose enumerable own property pairs are to be returned |
Return Value
An array of [key, value] pairs
Examples
const obj = { a: 1, b: 2, c: 3 };
console.log(Object.entries(obj)); // [['a', 1], ['b', 2], ['c', 3]]const user = { name: 'Alice', age: 30 };
for (const [key, value] of Object.entries(user)) {
console.log(`${key}: ${value}`);
}const obj = { x: 1, y: 2 };
const map = new Map(Object.entries(obj));
console.log(map.get('x')); // 1Understanding Object.entries
The Object.entries method in JavaScript returns an array of a given object's own enumerable string-keyed property key-value pairs. It belongs to the Object object and is one of the most widely used methods for working with object values in modern JavaScript and TypeScript applications.
The method signature is Object.entries(obj). It accepts 1 parameter: obj. When called, it returns an array of [key, value] pairs. Understanding when and how to use entries() helps you write more expressive, readable code.
Common use cases for Object.entries include data transformation, input validation, API response processing, and building reusable utility functions. It works well alongside related methods like object-keys, object-values, object-fromentries, enabling you to chain operations together for complex data manipulation pipelines.
Browser support for Object.entries is excellent across all modern browsers including Chrome, Firefox, Safari, and Edge. It is also fully supported in Node.js and Deno. For older environments, transpilation with Babel or a polyfill may be needed.
Browser Compatibility
Supported in all modern browsers (Chrome, Firefox, Safari, Edge) and Node.js. Part of the ECMAScript standard.
Related Methods
Object.keysReturns an array of a given object's own enumerable string-keyed property names
Object.valuesReturns an array of a given object's own enumerable string-keyed property values
Object.fromEntriesTransforms a list of key-value pairs into an object
Array.prototype.entriesReturns a new array iterator object that contains the key/value pairs for each index in the array
More Object Methods
Other methods in the Object object
Related Tools
More Object Methods
Explore JavaScript Methods
Browse our complete reference of 410 JavaScript methods with syntax, examples, and explanations.