Skip to content

Instantly share code, notes, and snippets.

@raganwald
Created March 15, 2016 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raganwald/18a46dabd324f752d151 to your computer and use it in GitHub Desktop.
Save raganwald/18a46dabd324f752d151 to your computer and use it in GitHub Desktop.
Is this valid or invalid ES6?
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
@bdukes
Copy link

bdukes commented Mar 15, 2016

@raganwald, I agree with @nikitadyumin, the only issue here is const. Runs fine on Edge (with full generator support) when const becomes let.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment