Open
Description
Version
v18.11.0
Platform
Darwin MacBook-Pro.local 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:19:52 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T6000 arm64
Subsystem
No response
What steps will reproduce the bug?
There is an inconsistent behavior of nodejs REPL executing try { for ( await of [ ] ); } catch { }
with respect to just executing test.js
file.
// test.js
try {
for ( await of [ ] );
} catch { }
$ node test.js
// no error
$ node
Welcome to Node.js v18.11.0.
Type ".help" for more information.
> try{ for ( await of [ ] ); } catch { }
Uncaught SyntaxError:
try{ for ( await of [ ] ); } catch { }
^
Unexpected token ']'
How often does it reproduce? Is there a required condition?
No response
What is the expected behavior?
No response
What do you see instead?
Running try{ for ( await of [ ] ); } catch { }
with nodejs REPL throws SyntaxError
but executing the test.js
file using nodejs terminates without error.
Additional information
No response