Skip to content

Can't define an undefined variable because it was already declared? 🤔 #3227

Closed
@Chuckytuh

Description

@Chuckytuh
  • Node.js Version: v12.19.0; v14.7.0
  • OS:
  • Scope (install, code, runtime, meta, other?): runtime
  • Module (and version) (if relevant): n/a

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:

Welcome to Node.js v14.7.0.
Type ".help" for more information.
> let x = Object.create()
Uncaught TypeError: Object prototype may only be an Object or null: undefined
    at Function.create (<anonymous>)
> x
Uncaught ReferenceError: x is not defined
> let x = Object.create({})
Uncaught SyntaxError: Identifier 'x' has already been declared
>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions