Created
September 13, 2015 21:56
-
-
Save vbauerster/62b3a3bbffe591e17d04 to your computer and use it in GitHub Desktop.
This file contains 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
function* objectEntries(obj) { | |
let propKeys = Reflect.ownKeys(obj); | |
for (let propKey of propKeys) { | |
yield [propKey, obj[propKey]]; | |
} | |
} | |
let jane = { first: 'Jane', last: 'Doe' }; | |
for (let [key, value] of objectEntries(jane)) { | |
console.log(`${key}: ${value}`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment