Environment
Google Chrome: 61.0.3163.79 beta (64 bit) (cohort: Beta)
JavaScript Engine: V8 6.1.534.32
Code
In Chrome, open a new tab, type following code one-by-one in the console:
let [a = b, b = 1] = [];
typeof a;
let a = 'other value';
a = 'other value';
Question
Can someone explain why the 1st statement let [a = b, b = 1] = []
make variable a
to be 'a is not defined' and 'Identifier 'a' has already been declared' at the same time?
What is the magic in the 1st statement execution?
Is it related to the ES6 “Temporal Dead Zone” (TDZ)?
Update
The sample code is invalid, I just want to know the reason about the outputs. :)