Why am I failing the tests though correct value gets displayed in console?

Why am I failing the tests though correct value gets displayed in console?
0

#1

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

Hi all, I’m doing this assignment, but I think the test was written incorrectly. Thought I’d double check. My implementation (bolded) should be correct (it gives me the right value) but it keeps failing the test for the use of destructuring.

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

function getTempOfTmrw(avgTemperatures) {
“use strict”;
// change code below this line
const { tomorrow: tempOfTomorrow } = AVG_TEMPERATURES; //change in this line
// change code above this line
return tempOfTomorrow;
}

console.log(getTempOfTmrw(AVG_TEMPERATURES)); // should be 79


#2

hi @pc328,
the ‘use strict’ statement is restricting you from accessing AVG_TEMPERATURES. They want you to destructure a different reference.


#3

I changed your category to JavaScript and added an actual description to your topic title instead of a url.


#4

Thank you! Stupid mistake on me!