-
Notifications
You must be signed in to change notification settings - Fork 285
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
Can't define an undefined variable because it was already declared? 🤔 #3227
Comments
Can confirm the same thing happening with node v14 lts. i guess its because of the error at the first assignment. but its interesting behaviour for sure. |
I will try replicating the behaviour. |
NodeJS cant set variables if they error. They are kept as undefined. I suggest using let x = {} to make objects instead of Object.create if you dont know how it works. Object.create makes an object with an existing object. Aka:
A bit like typescript interfaces of some sort. |
You can find more info in nodejs/node#8309 |
I'm a bit confused by the following snippet. That problem (?) occurs on nodejs 12 as well, but, the same snippet does not result on the same error on Chrome, for example. Can someone please explain to me why and if this isn't a bug?
node repl:
The text was updated successfully, but these errors were encountered: