Created
March 10, 2019 18:14
-
-
Save BolajiAyodeji/ae8829a2efffa7fa93a6e0511d9d4158 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
let obj = { | |
key1: "value1", | |
key2: "value2", | |
key3: "value3" | |
} | |
let items = Object.getOwnPropertyNames(obj); | |
console.log(items); | |
// ["key1", "key2", "key3"] | |
items.map(key => { | |
let value = obj[key]; | |
console.log(key, value) | |
}); | |
// key1 value1 | |
// key2 value2 | |
// key3 value3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment