const obj = {
name: "Human",
age: 0,
address: "Earth",
profession: "Coder",
};
console.log(Object.keys(obj)); // name, age, address, profession
Objects maintain the order in which the keys were created.
Thanks for reading π
Follow @codedrops.tech for daily posts.
Instagram β Twitter β Facebook
Micro-Learning β Web Development β Javascript β MERN stack β Javascript
codedrops.tech
Top comments (1)
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.