Destructuring assignment problem
- by Eli Grey
Why does for ([] in iterable); work fine but [void 0 for ([] in iterable)] throw a syntax error for invalid left-hand assignment?
For example, I would expect the following code to work, but it doesn't (the assertion isn't even done due to the syntax error):
let (i = 0, iterable = (i for (i in [1, 2, 3, 4]))) {
for ([] in iterable) i++;
console.assertNotGreater([void 0 for ([] in iterable)].length, i);
}