Skip to content

Commit 620ee42

Browse files
jasnelltargos
authored andcommitted
repl: document top level await limitation with const/let
Fixes: #17669 Signed-off-by: James M Snell <[email protected]> PR-URL: #38449 Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]>
1 parent a0c566f commit 620ee42

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

doc/api/repl.md

+17
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,23 @@ undefined
233233
undefined
234234
```
235235

236+
One known limitation of using the `await` keyword in the REPL is that
237+
it will invalidate the lexical scoping of the `const` and `let`
238+
keywords.
239+
240+
For example:
241+
242+
```console
243+
> const m = await Promise.resolve(123)
244+
undefined
245+
> m
246+
123
247+
> const m = await Promise.resolve(234)
248+
undefined
249+
> m
250+
234
251+
```
252+
236253
### Reverse-i-search
237254
<!-- YAML
238255
added:

0 commit comments

Comments
 (0)