Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Variable Declaration and Reference Errors in Node.js REPL and Browser Console #54055

Closed
UlisesGascon opened this issue Jul 26, 2024 · 3 comments
Labels
repl Issues and PRs related to the REPL subsystem.

Comments

@UlisesGascon
Copy link
Member

UlisesGascon commented Jul 26, 2024

Version

22.5.1

Platform

Linux 6.5.0-45-generic #45~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Jul 15 16:40:02 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

REPL

What steps will reproduce the bug?

Screenshot from 2024-07-26 11-40-33

Screenshot from 2024-07-26 11-38-56

In both the Node.js REPL and the browser console, there is a reference error when trying to assign a variable obj1 that has not been declared to another variable obj2 (this is expected).

In the Node.js REPL, after the initial ReferenceError, attempting to correct the code by assigning obj to obj2 results in a SyntaxError due to obj2 being declared already. Further attempts to access obj2 result in a ReferenceError (different from browser).

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

The expected behavior in both the Node.js REPL and the browser console should be consistent with JavaScript's rules for variable declarations and assignments.

What do you see instead?

The obj2 reference error.

Additional information

I am using Chromium Version 126.0.6478.126 (Official Build) snap (64-bit) in Ubuntu 22.04

@marco-ippolito marco-ippolito added the repl Issues and PRs related to the REPL subsystem. label Jul 26, 2024
@H4ad
Copy link
Member

H4ad commented Jul 26, 2024

@avivkeller
Copy link
Member

FWIW if I recall, there is an open issue about this behavior, but I need to find it.

@BridgeAR
Copy link
Member

BridgeAR commented Apr 3, 2025

Duplicate of #8309

@BridgeAR BridgeAR marked this as a duplicate of #8309 Apr 3, 2025
@BridgeAR BridgeAR closed this as completed Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

No branches or pull requests

5 participants