Use Destructuring Assignment to Assign Variables from Objects Issue

I’m pretty sure I’m destructuring it properly as the code is running however the test keeps saying “destructuring with reassignment was (not) used”. Code is giving me the correct result and everything what am I missing?

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/71.0.3578.98 Safari/537.36.

You need to use the argument if the function , not the global object

Thanks I can’t believe I missed that haha.

Look at your code and ask yourself two questions:

Why do you use AVG_TEMPERATURES here?

const { tomorrow : tempOfTomorrow } = AVG_TEMPERATURES;

Why did you pass in the argument avgTemperatures to your function and not use it?

function getTempOfTmrw(avgTemperatures)

Hah! I typed too slow…glad you got it :smiley: