Created
March 15, 2016 15:51
-
-
Save raganwald/18a46dabd324f752d151 to your computer and use it in GitHub Desktop.
Is this valid or invalid ES6?
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 * append (...iterables) { | |
for (const iterable of iterables) { | |
yield * iterable; | |
} | |
} | |
const lyrics = append(["a", "b", "c"], ["one", "two", "three"], ["do", "re", "me"]); | |
for (const word of lyrics) { | |
console.log(word); | |
} | |
//=> | |
a | |
b | |
c | |
one | |
two | |
three | |
do | |
re | |
me |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@raganwald, I agree with @nikitadyumin, the only issue here is
const
. Runs fine on Edge (with full generator support) whenconst
becomeslet
.