Skip to content

Instantly share code, notes, and snippets.

@BolajiAyodeji
Created March 10, 2019 18:14
Show Gist options
  • Save BolajiAyodeji/ae8829a2efffa7fa93a6e0511d9d4158 to your computer and use it in GitHub Desktop.
Save BolajiAyodeji/ae8829a2efffa7fa93a6e0511d9d4158 to your computer and use it in GitHub Desktop.
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