What is the Object.entries() method in JavaScript?

The object.entries() method returns an array of [key,value] pairs that contain all of the object’s properties. This array only includes the enumerable properties and does not include properties from the prototype chain.

Enumerable properties are properties created with simple assignment or with a property initializer.

The order of the properties is the same as that given by looping over the property values of the object manually.

Syntax

The function takes an object whose enumerable property (i.e.,[key, value] pair) is to be returned. It returns an array containing these properties.

Object.entries(obj)

Code

The following code demonstrates the use of the Javascript object.entries() method.

// A map object
const obj = { 'adam': 100, 'smith': 40, 'jon': 62 };
// The object.entries method converts this map
// object into array of properties
console.log(Object.entries(obj));
// Accessing the second property of this array.
console.log(Object.entries(obj)[1]);
New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved