repl: document top level await limitation with const/let

Fixes: https://github.com/nodejs/node/issues/17669
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/38449
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
This commit is contained in:
James M Snell
2021-04-27 19:38:50 -07:00
parent bdb6c597a7
commit 346f0e99cd

View File

@@ -233,6 +233,23 @@ undefined
undefined
```
One known limitation of using the `await` keyword in the REPL is that
it will invalidate the lexical scoping of the `const` and `let`
keywords.
For example:
```console
> const m = await Promise.resolve(123)
undefined
> m
123
> const m = await Promise.resolve(234)
undefined
> m
234
```
### Reverse-i-search
<!-- YAML
added: