Tell us what’s happening:
why is am i not able to swap the values.
Your code so far
let a = 8, b = 6;
(() => {
"use strict";
// change code below this line
const [b,a] = [a,b];
// 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; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays