This Javascript code gives a syntax error ("unexpected identifier") on the "yield" line in chrome version 70.0.3538.110:
function foo() {
var arr = [0];
yield arr;
}
This has no error:
function foo() {
var arr = [0];
return arr;
}
This also has no error:
function foo() {
var arr = [0];
yield [arr];
}
I can yield the [] version and subscript it, but is there a cleaner way?
I want to yield the array many times during the execution of the function, as it gets mutated.