Last active
August 29, 2015 14:03
-
-
Save tyage/0a591e63f2968c114e72 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
let cats = { | |
'@@iterator': function () { | |
let names = Object.keys(this), i = 0 | |
return { | |
next: () => i < names.length ? { value: names[i++] } : { done: true } | |
} | |
}, | |
a: 1, | |
b: 2, | |
c: 3, | |
}; | |
console.log(Array.from(cats)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment