DEV Community

Mehul Lakhanpal
Mehul Lakhanpal

Posted on • Originally published at codedrops.tech

Object keys are stored in insertion order

const obj = {
  name: "Human",
  age: 0,
  address: "Earth",
  profession: "Coder",
};

console.log(Object.keys(obj)); // name, age, address, profession
Enter fullscreen mode Exit fullscreen mode

Objects maintain the order in which the keys were created.


Thanks for reading 💙

Follow @codedrops.tech for daily posts.

InstagramTwitterFacebook

Micro-Learning ● Web Development ● Javascript ● MERN stack ● Javascript

codedrops.tech

Discussion (1)

Collapse
yousaf profile image
Yousaf

ES6 defines standard rules for the order of properties in an object. See this stackoverflow question to understand the order of properties in an object.