DEV Community

Mehul Lakhanpal
Mehul Lakhanpal

Posted on • Originally published at

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 for daily posts.


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

Discussion (1)

yousaf profile image

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.