// running tests
destructuring WITH reassignment was used
// tests completed
I must have made a mistake somewhere but I can’t find it. Here is my code:
const AVG_TEMPERATURES = {
today: 77.5,
tomorrow: 79
};
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;
}
console.log(getTempOfTmrw(AVG_TEMPERATURES)); // should be 79
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, but you’re not to use that object in the function
I made the same error, some of these assignments are so simple but the way they are explained makes hard to understand sometimes. This one took me about an hour to solve.
//destrucure obj data
let {results} = data;
//destructure arr
let [profile] = results;
//Assign Name
document.querySelector('h2').textContent = profile.name.title + ' '+profile.name.last+' '+profile.name.first;
//Display Image
document.querySelector('img').src = profile.picture.large;
a
clearNotice();
};
const getAUserProfile = () => {
const api = 'https://randomuser.me/api/';
// make API call here
fetch(api)
.then(res => res.json())
.then(results => {return displayUserPhotoAndName(results)});
notify(`requesting profile data ...`);
notify(`requesting profile data ...`);
};
const startApp = () => {
// invoke the getAUserProfile here
getAUserProfile();
};
startApp();
</script>
[quote="Gurrudfiss, post:1, topic:229773, full:true"]
I am trying to solve the [ES6: Use Destructuring Assignment to Assign Variables from Objects](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects) challenge and I get this error message when I run the test:
// running tests
destructuring WITH reassignment was used
// tests completed
I must have made a mistake somewhere but I can’t find it. Here is my code:
const AVG_TEMPERATURES = {
today: 77.5,
tomorrow: 79
};
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;
}
console.log(getTempOfTmrw(AVG_TEMPERATURES)); // should be 79
What am I doing wrong?
Thanks for your help!
[/quote]
i have been stuck here for days, Please what am i not doing right ?