SyntaxError: Unexpected Identifier (Generators in ES6)
Summarizing the comments: you can’t use yield inside a regular function, so you can’t use yield with forEach. Here an example of “generatorized” foreach: function * foreach (arr, fn) { var i for (i = 0; i < arr.length; i++) { yield * fn(arr[i]) } } function * gen (number) { yield number + 1 … Read more