I’ve been stuck on this challenge about one hour someone could explain it for me???
Your code so far
const AVG_TEMPERATURES = {
today: 77.5,
tomorrow: 79
};
function getTempOfTmrw(avgTemperatures) {
"use strict";
// change code below this line
const tempOfTomorrow = AVG_TEMPERATURES.tomorrow; // 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/68.0.3440.106 Safari/537.36 OPR/55.0.2994.47.
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
Here you are saying that you want a const called tempOfTomorrow that has the same value of avgTemperatures.tomorrow
but the instructions and tests are expecting you to only capture tomorrow’s value and assign it to tempOfTomorrow.
const {tomorrow: tempOfTomorrow}
You’re using the object used to test the function inside the function. The function takes an argument (avgTemperatures), and you can test it using the provided object AVG_TEMPERATURES
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.
I was stuck for a few hours. The example code and the challenge code does not match. It is still confusing to me, even though they had fixed it from the initial challenge. Look it up on GitHub.
I lost a few extra minutes on this challenge too.
I think this should be an example for bad naming practices and the problems they cause
Yes you can get the correct assignment by using the globally declared object, yet the challenge wants you to solve it through the argument passed to the function.