You are correct about the description: the description is wrong, and tells you to destructure AVG_TEMPERATURES
when you should be destructuring avgTemperatures
instead. This is a bug in the instructions, which should be fixed by the time the next version rolls out.
OMG! That’s so annoying. Having answers like this hardcoded in really throw me through a loop. For the longest time I thought I had it wrong
In a case like this it may also be that the tests check the function with an other object, to check that the code is reutilizable and doesn’t use a global variable but function parameter
Why this will not pass the test?Thank you
You need to use the function parameter
anyone can clarify,
why it only accepts lowcaps avgTemperatures? instead of AVG_TEMPERATURES ?
the tests are checking what you have written, as such they expect you to use the function parameter, like you should do whenever you are in a function
The instructions that tell you to destructure AVG_TEMPERATURES are wrong, that’s all. It’s already fixed in the master branch, but due to some recent reorganizations of the repo, there’s been some delays in deploying the latest version. Try the challenge out on http://freecodecamp.rocks and see if it works better for you (note that everything on freecodecamp.rocks is reset regularly, so don’t do any work you need to keep around)
const { tomorrow:tempOfTomorrow} = avgTemperatures;
const { objectPropName: newVariableName } = objectName;
show your code so we can help you
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;
}
can someone explain me on how this works, I have tried this way and it still does not work.
you need to use the function parameters when you are in a function
try this one
const { tomorrow: tempOfTomorrow } = avgTemperatures
const {tomorrow: tempOfTomorrow} = avgTemperatures ;
// Doing so will have the right results