Am i missing something : se Destructuring Assignment to Pass an Object as a Function's Parameters

Tell us what’s happening:
i am getting the following error message
half(stats) should be 28.015

The hint told me to get rid of stats so i did

what am i doing wrong here?
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 = (stats) => (stats.max + stats.min) / 2.0; 

const half = ({max, min}) => { 

// 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/84.0.4147.89 Safari/537.36.

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

Link to the challenge:

You are not performing any operation with the parameters inside the function.

1 Like

How you add the parameters to the function is fine as you wrote it, but your function is currently empty. You still need to calculate (maximum + minimum) / 2. For minimum/maximum you can now use the new abbreviations.

(Beware, that the setup code uses a single line arrow function without curly braces. That returns the result automatically. If you use curly braces you need to add the return keyword.)

1 Like