Array Destructuring Assignment

Tell us what’s happening:

I’m using array restructuring here, am I not? This is getting an error saying I’m not.

Your code so far


let a = 8, b = 6;
// Only change code below this line
[a,b] = [6, 8];

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36.

Challenge: Use Destructuring Assignment to Assign Variables from Arrays

Link to the challenge:

You’re using destructing, but you should use it to swap the two value stored in the variables. You have instead hardcoded an array of two values to destructure.

3 Likes