Destructuring argument returns undefined

Tell us what’s happening:

When I enter “console.log(stats.half);”
It returns undefined. How do I run the half function?

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

console.log(stats.half);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36.

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

Link to the challenge:

the stats object doesn’t have a property called half
you may need to review how to call a function

Hello there.

stats does not have a property called half. You have defined half as a function.

Do you know how I would call the half function?
Tried to do console.log(half);

Doesnt work either.

When I try to call the function with console.log(half);
It doesn’t work either. Do you know how I would call the half?

half is the function. To call a function you need to put round parenthesis soon after it and the needed arguments inside the parenthesis
if I wanted to call the myFunc function, I wound myFunc()

Think I got it!

Edited:
console.log(half(stats));