Use Destructuring Assignment to Assign Variables from Objects 3

Tell us what’s happening:

Your code so far

  today: 77.5,
  tomorrow: 79

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

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

Hi, I cannot understand wats wrong, any ideas?

User Agent is: Mozilla/5.0 (Windows NT 6.1; rv:63.0) Gecko/20100101 Firefox/63.0.

Link to the challenge:

First of all you shouldn’t be referring to AVG_TEMPERATURES inside the function - it is passed in as avgTemperatures so that is how you are supposed to be using that value inside the function. Secondly, this line needs work:

const {AVG_TEMPERATURES:tomorrow}=tempOfTomorrow;

The order is wrong. If you have an object that is:

const obj = { value: 42 };

You could get it out with:

const { value } = obj;

But we want to also rename it at the same time, so we need something like:

const { value: newValueName } = obj;

Is that clear? Let us know if that is not enough of a hint?

yes, but I had to check again in the forum. I will have to check more on JS building blocks. I tryed a lot of things but didn’t work. Finally I managed to pass.

Hey, you want to pair program or work on some practice project?

Sorry, I’m busy with a new job.

No worries, thanks for reply anyway.

Thank you for your answer, I was completely banging my head against the wall.