avgTemperatures Use Destructuring Assignment to Assign Variables from Objects

Tell us what’s happening:
Why does avgTemperatures solve the problem, but AVG_TEMPERATURES does not?

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} = avgTemperatures; // 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/77.0.3865.90 Safari/537.36.

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

Because JS is headletter and space senstive

1 Like

It’s also because there’s a typo in the instructions that tells you to destructure AVG_TEMPERATURES. It’s been fixed for a dog’s age, but we also haven’t deployed a new curriculum version in that long due to internal reorganization. Soon now :slight_smile:

2 Likes

Can you elaborate on this?