Created
September 10, 2018 13:27
-
-
Save hulefei/4e7e92b35fa78673018d50e23149cd8b 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]]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment