How do I implement destructuring assignment to my code

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 = tomorrow: 79; // 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 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36.

Link to the challenge:

You got the syntax wrong. It’s supposed to be:

const {keyName : variableName} = inputObject;

So, keyName is the name of the property that you want to read, variableName is what you want to call that property within the function, and inputObject is the object from which you’re taking the property (just be careful what that object is called in your function). Now you just have to put in the values given in the assignment. Hope this helps and let me know if you’re still stuck. Good luck! :slight_smile:

1 Like
const tempOfTomorrow;
({ tomorrow : tempOfTomorrow } = avgTemperature ); // change this line
  // change code above this line

const { tomorrow : tempOfTomorrow } = avgTemperature );

return tempOfTomorrow;