Use Destructuring Assignment to Assign Variables from Objects ES

Tell us what’s happening:
couldn’t pass tests

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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36.

Hint: Think about a variable local to the the getTempOfTmrw function which you could use instead of AVG_TEMPERATURES.

1 Like

I was struggling with this one too, when I read this I face-palmed pretty hard…

Thanks for the hint.

This challenge has actually been rewritten so that either the global variable or the function’s parameter can be used. We are just waiting for the changes to be deployed to production in the near future.

Yes , Thanks for your help

Unfortunately, I still don’t get ::worried: