Use Destructuring Assignment to Assign Variables from Objects: Stuck

Tell us what’s happening:

The error I’m getting is “getTempOfTmrw is not defined”

Your code so far


const AVG_TEMPERATURES = {
  today: 77.5,
  tomorrow: 79
};

function TempOfTmrw(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 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 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

It says it’s undefined because it’s undefined - *getTempOfTmrw. * is not defined anywhere in your code. I always joke that the problem with computers is that they always do exactly what you tell them to.

It seems that you somehow accidentally lopped three letters off of your function definition.

1 Like