0
Bug in your Code?
This sample code seems to have a bug. After the first line, a and b are 'undefined'. Is that the intention? ES6 Destructuring: The destructuring syntax also simplifies assignment and swapping values: let a, b, c = 4, d = 8; [a, b = 6] = [2]; // a = 2, b = 6 [c, d] = [d, c]; // c = 8, d = 4
3 odpowiedzi
+ 2
Yes, unlike c and d they aren't given a value until the 2nd line which is 1 example of using destructuring.
3rd line is another example.
+ 2
+ 2
there is no bug