Hello.
First time round I did this (similar to redone’s solution) :
function getTempOfTmrw(avgTemperatures) {
const {tomorrow} = AVG_TEMPERATURES
const tempOfTomorrow = tomorrow
return tempOfTomorrow
}
and I got the right result (79) but when I clicked on ‘Run the tests’ I got:
// running tests
destructuring with reassignment was used
// tests completed
This sounded right to me (“destructuring with reassignment was used”) but at this point I realised that I hadn’t used the avgTemperatures parameter (as you (ieahleen) indicated) so I rewrote my code:
function getTempOfTmrw(avgTemperatures) {
const {tomorrow} = avgTemperatures
const tempOfTomorrow = tomorrow
return tempOfTomorrow
}
Again, this returned (79), the correct answer and again, after clicking ‘Run the tests’ I got the same message as before:
// running tests
destructuring with reassignment was used
// tests completed
and couldn’t click through to the next challenge.
I felt certain (before I ran the tests) that this would be the correct solution because the function is now flexible, e.g. if I created an identical object with the same name:
const REAL_TEMP = {
today: 20,
tomorrow: 100
}
using exactly the same function, but calling it by passing the name of the new object as its argument:
console.log(getTempOfTmrw(REAL_TEMP))
I’d get the correct result (100).
As I said, the actual results are correct, so I imagine I can’t pass this challenge because of something
lacking in the syntax.
Could you give me another clue as to where I’m going wrong?
PS Just noticed that title of challenge page is “Destructuring assignment…” and message received after running tests mentions “Destructuring with reassignment” - not sure whether that is a typo or whether it’s pointing to my problem. (Googled “Destructuring with reassignment” but only got back “assignment” results).