Tell us what’s happening:
I already passed the challenge by putting a and b value separate but the question is: Why when I put [a, b] = [6, 8]; does not work?
Your code so far
let a = 8, b = 6;
(() => {
"use strict";
// change code below this line
[a] = [6];
[b] = [8];
// change code above this line
})();
console.log(a); // should be 6
console.log(b); // should be 8
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays