Ojadox
January 14, 2020, 9:46am
1
Tell us what’s happening:
Hello guys , this is my code , and i don’t know where’s the mistake , thank u for the help in advance
Your code so far
const LOCAL_FORECAST = {
yesterday: { low: 61, high: 75 },
today: { low: 64, high: 77 },
tomorrow: { low: 68, high: 80 }
};
// change code below this line
const { tomorrow : { max : maxOfTomorrow }} =forecast;
// change code above this line
console.log(lowToday); // should be 64
console.log(highToday); // should be 77
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36
.
Challenge: Use Destructuring Assignment to Assign Variables from Nested Objects
Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects
ilenia
January 14, 2020, 11:30am
2
you need these ones not maxOfTomorrow
see challenge description that says:
Replace the two assignments with an equivalent destructuring assignment. It should still assign the variables lowToday
and highToday
the values of today.low
and today.high
from the LOCAL_FORECAST
object.
Ojadox
January 14, 2020, 11:33am
3
oh now i can see , thank u so much for the feedback <3
One other thing to note: by this code, the forecast
object should contain:
forecast = {
tomorrow: {
max: /* someValue */,
// ...more potential properties...
}
}
Is that accurate? Are you looking for a property named max
?
I have tested the challenge .I found out the code . The code is :
const LOCAL_FORECAST = {
yesterday: { low: 61, high: 75 },
today: { low: 64, high: 77 },
tomorrow: { low: 68, high: 80 }
};
// Only change code below this line
const { today: { low: lowToday, high: highToday } } = LOCAL_FORECAST;****strong text
// Only change code above this line