The following for-of loop works:
for (const e of a)
The ES6 specification describes this as:
ForDeclaration : LetOrConst ForBinding
The imperative for loop will not work:
for (const i = 0; i < a.length; i += 1)
This is because the declaration is only evaluated once before the loop body is executed.