Use Destructuring Assignment to Assign Variables from Objects ??

Tell us what’s happening:
The code result was correct, but the compiler did not like the code because of the following reason
// running tests

destructuring with reassignment was used

// tests completed

Your code so far


const AVG_TEMPERATURES = {
  today: 77.5,
  tomorrow: 79
};

function getTempOfTmrw(avgTemperatures) {
  "use strict";
  // change code below this line
  const tempOfTomorrow = avgTemperatures.tomorrow; // change this line
  // change code above this line
  return tempOfTomorrow;
}

console.log(getTempOfTmrw(AVG_TEMPERATURES)); // should be 79

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36.

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

Because it’s true that deconstructing was not used.

Take a closer look at this example.

const { x : a, y : b, z : c } = voxel // a = 3.6, b = 7.4, c = 6.54

You want to deconstruct it inside curly brackets.

1 Like