Destructuring Assignment to Pass an Object as a Functions Parameters

** I’m sorry if this question is kinda stupid and the english is bad,**

Below is the right answer for the challenge, my question is , when i put curly braces in code body, it return undefined, can someone explain it to me? thank you

const half = ({max,min})=>{
  max + min / 2.0;
console.log(half(stats)); // return undefined

The right answer

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

Challenge: Use Destructuring Assignment to Pass an Object as a Function’s Parameters

Link to the challenge:

When you use curly braces to define the function body after the arrow then you are required to explicitly return a value (i.e. you have to use return in the function body). When you don’t use curly braces then the return is implied.

1 Like

i see, thank you very much for the answer