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.