Closed
Description
- Version: v10.9.0
- Platform: Windows 10 Pro 10.0.17134 x64
- Subsystem: REPL
The REPL is working great with regular await, but doesn't seem to be able to handle the new for await of syntax that was introduced as part of the async-iteration spec.
for await of
works when wrapping the call with an async function, it only fails if used at the top level.
This fails:
$ node --experimental-repl-await
> for await (let i of [1,2,3]) console.log(i)
for await (let i of [1,2,3]) console.log(i)
^^^^^
SyntaxError: Unexpected reserved word
This works:
> (async () => { for await(let i of [1,2,3]) console.log(i) })()
Promise {
<pending>,
domain: ...etc }
> 1
2
3