Tell us what’s happening:
I don’t understand this at all.
Instructions:
Consider the following ES5 code:
var voxel = {x: 3.6, y: 7.4, z: 6.54 };
var x = voxel.x; // x = 3.6
var y = voxel.y; // y = 7.4
var z = voxel.z; // z = 6.54
Ok awesome. An object with key value pairs, that we are then assigned to global variables. I know this! But then…
Here’s the same assignment statement with ES6 destructuring syntax:
const { x, y, z } = voxel; // x = 3.6, y = 7.4, z = 6.54
What? Thats not at all what the previous code was. First the keys don’t have values. So x shouldn’t be 3.6. Second no global variables are being assigned to anything. This is literally just equal to this:
const Obj = {x,y,z};
Aka an object with declared keys (no values).
I am so stuck. Read the ntructions like 20 times and I still have 0 clue about what I have to do.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects