Use Destructuring Assignment to Assign Variables from Arrays Code Doesn't Work

Use Destructuring Assignment to Assign Variables from Arrays Code Doesn't Work
0.0 0

#1

I don’t get why this won’t work, i just followed the array swapping here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment

Your code so far


let a = 8, b = 6;
(() => {
  "use strict";
  // change code below this line
   [a,b] = [b,a];
  // 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 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays/


#2

Works for me! Try again