Last active
April 13, 2021 11:04
-
-
Save shoaibmehedi7/970a90f2ca0c570a86a920a49ffb115f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple way | |
const person = { name: "Shoaib", Age: 25, Gender: "Male" }; | |
for (const property in person) { | |
console.log(`${property}: ${person[property]}`); | |
} | |
// Another way | |
const anotherPerson = { | |
Name: 'Shoaib', | |
Age: 25, | |
Gender:"Male" | |
}; | |
for (const [key, value] of Object.entries(anotherPerson)) { | |
console.log(`${key}: ${value}`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment