Tell us what’s happening:
going back over some completed modules trying solutions in different ways and I came across the below which does not pass even though I’m gaining access to min
and max
through destructuring. i get the message indicating that destructuring was not used.
can someone point out what, if anything, is incorrect with the following solution?
Your code so far
const stats = {
max: 56.78,
standard_deviation: 4.34,
median: 34.54,
mode: 23.87,
min: -0.75,
average: 35.85
};
const half = (function() {
"use strict"; // do not change this line
// change code below this line
return (stats) => {
// use function argument destructuring
const {max, min} = stats;
return (max + min) / 2.0;
};
// change code above this line
})();
console.log(stats); // should be object
console.log(half(stats)); // should be 28.015
Please Note: I’ve already passed this challenge with
const half = (function() {
"use strict"; // do not change this line
// change code below this line
return ({max,min}) => {
// use function argument destructuring
return (max + min) / 2.0;
};
// change code above this line
})();
but based on the example given in the challenge (below) my solution should be valid.
const profileUpdate = (profileData) => {
const { name, age, nationality, location } = profileData;
// do something with these variables
}
Your browser information:
User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0
.
Link to the challenge: