Use Destructuring Assignment to Assign Variables from Objects Doesnt Pass

Tell us what’s happening:
sometimes i misread what im ment to do im pretty sure i havnt but it isnt passing so clearly i have

Your code so far

const {tomorrow:tempOfTomorrow} = AVG_TEMPERATURES; // change this line
that comes to the 79 and as far as im conserned that is what they wanted me to do am i misreading the challenge?


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; rv:67.0) Gecko/20100101 Firefox/67.0.

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

When you have a function that have a parameter you should use that to make your function reusable instead of referencing directly a global object from inside the function

1 Like

Hi @aoc386!

The problem here is that you are not using the variable sent in the parameters of the function. You don’t have to reference the global variable.

1 Like

thanks both u 2. yeah its on part me being lazy and misreading sorry! i just swaped to the local parameter and it passes. i liteually am learning the patterns and then sometimes not actually looking propperly at what its asking me to do in the challenge the infomation is sinking in i just misread stuff from time to time and when it passes the answer its ment to pass i get lost very and kinda frustated quickly thanks again!

1 Like