Hi so could anyone explain to me why the solution uses parentheses on return, but curly braces is wrong?
I sort of understand but it is confusing, I understand you don’t need any braces in an arrow function, but in the example here it does have curly braces {} ( so I guess if you want to return an object you add {}), and if you want to add two parameters you use (parentheses) ?
Ty ![]()
WRONG:
{max + min} / 2.0;
**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
};
// Only change code below this line
const half = ({max,min}) => (max + min) / 2.0;
// Only change code above this line
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36
Challenge: Use Destructuring Assignment to Pass an Object as a Function’s Parameters
Link to the challenge:
