I was working through the problem trying to look at the example for reference. When I did console.log for the problem I kept getting undefined. My code below works because I used a text compare site with the solution and notice I had extra curly braces.
My code so far
const stats = {
max: 56.78,
standard_deviation: 4.34,
median: 34.54,
mode: 23.87,
min: -0.75,
average: 35.85
};
// Only change code below this line
const half = ({max, min}) => (max/2 + min/2);
// Only change code above this line
console.log(half(stats))
The example provided in the challenge shows to implement the code as
const profileUpdate = ({ name, age, nationality, location }) => {
/* do something with these fields */
}
If you notice in the third line from the bottom on “My code so far”, after => (the arrow) there are no curly braces wrapping the returning math function.
In the “example provided” the code shows the comment {wrapped in curly braces} indicating to me that the math function should be wrapped in the {curly braces}. but the following code returns “undefined”.
const stats = {
max: 56.78,
standard_deviation: 4.34,
median: 34.54,
mode: 23.87,
min: -0.75,
average: 35.85
};
// Only change code below this line
const half = ({max, min}) => {(max/2 + min/2)};
// Only change code above this line
console.log(half(stats))
I may be reading into this deeper than I should, but I would just like some clarity on whether I am reading the example wrong, the text editors’ console is reading the code wrong or if this is just a mistake in the example code.
Very Respectfully,
Justin
2nd week 
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36.
Challenge: Use Destructuring Assignment to Pass an Object as a Function’s Parameters
Link to the challenge:
