Use Destructuring Assignment to Assign Variables from Objects destructuring reassignment issue

Tell us what’s happening:
I have followed the example in destructring and reassigning tempOfTomorrow
giving me the the required out…

My issue is that I am being is told that
" getTempOfTmrw(AVG_TEMPERATURES) should be 79" ->Passed
" destructuring with reassignment was used " -> Did not pass

I’m not sure if I am making an error or if there is a bug in in the editor :thinking:

Your code so far


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

function getTempOfTmrw(avgTemperatures) {
  "use strict";
  // change code below this line
  const {tomorrow : tempOfTomorrow} = AVG_TEMPERATURES; // 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 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0.

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

Thank You

Although you can technically use the global variable AVG_TEMPERATURES, try using a variable local to the function instead.

1 Like

Please don’t post solutions for the sake of it. That is what the Get a Hint button is for.

1 Like