From d846610b5ae9e45049d476105152d7370215daa4 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 27 Apr 2021 19:38:50 -0700 Subject: [PATCH] repl: document top level await limitation with const/let Fixes: https://github.com/nodejs/node/issues/17669 Signed-off-by: James M Snell --- doc/api/repl.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/doc/api/repl.md b/doc/api/repl.md index ab55411c356443..075fa91581c428 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -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