Skip to content

Instantly share code, notes, and snippets.

@noomorph
Last active July 18, 2019 09:27
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 noomorph/f9272f1a3f4a9d1f419c2e8dadfb5fe2 to your computer and use it in GitHub Desktop.
Save noomorph/f9272f1a3f4a9d1f419c2e8dadfb5fe2 to your computer and use it in GitHub Desktop.
generator.js:1:9: error: 'identifier' expected after 'function'
function* seq(n) {
~~~~~~~~^
shell returned 2
for (var x of [0, 1, 2]) {
print(x);
}
function* seq(n) {
for (var i = 0; i < n; i++) {
yield i;
}
}
for (var x of seq(3)) {
print(x);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment