Half stats should be 28.015?

What does this mean?

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) 


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

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

Link to the challenge:

You accidentally deleted some of the setup code. max and min are supposed to be added up and divided in half:

//Setup:
const half = (stats) => (stats.max + stats.min) / 2.0; 
1 Like

Let me check thank you!

I dont understand, I have added the set up code and is not working

My new code is:

const half = ({max, min}) => (max, min) / 2.0;

Still does not work
it returns -0.375

but it asks 28.015 :frowning:

(max, min) / 2.0

That doesn’t look like maths.

Dan How I am supposed to know I should do Math?
Please enlighten me

How else would you calculate the average of two numbers? What you have written above isn’t an arithmetical expression

1 Like

What value is it you believe (max, min) is?

This is the original code (stats.max + stats.min) here the value is the result of doing addition with stats.max and stats.min.

1 Like

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

Try this.

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

Thank you for understanding.

1 Like

Sure I understand.

Thank you for letting me know!

Indeed, it makes sense, but I did not look at the original code, instead I thought I needed to work out a completely new solution.
I guess in code, you need to look at the old code and analyse what can you keep in the new solution.
I am a newbie so thank you for your support!