1

I tried to run this code.

let a = b; //I'm sure that variable b is not defined.

Uncaught ReferenceError: b is not defined

I know this code causes this error.

b = 3;

Uncaught ReferenceError: b is not defined

let b = 3

Identifier 'b' has already been declared

Now, I can't put any String , Number,Null and Everything. And I can't define variable 'b'.

Is this Js Bug?

georg
  • 211,518
  • 52
  • 313
  • 390
  • 3
    It's because you're typing into the console, and the console environment is kind of weird when it comes to scoping. It also only occurs on some browsers. If you use `var` instead, it won't remain in the TDZ forever – CertainPerformance Oct 24 '19 at 05:59

0 Answers0