# Help Needed for this Assignment

Tell us what’s happening:

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
``````

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

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

Link to the challenge:

Hello there.

Do you have a question?

If so, please edit your post to include it in the Tell us what’s happening section.

The more information you give us, the more likely we are to be able to help.

Welcome to the forum!

Two issues.

First, you don’t need the curly braces here

Secondly, you deleted parenthesis from the original code.

Original
(stats.max + stats.min) / 2.0;

Removing the stats was correct but removing the parenthesis is incorrect.

Remember PEMDAS (Parentheses, Exponents, Multiplication/Division, Addition/Subtraction)

When you have the parenthesis, max + min will be executed first then that answer will be divided by 2.

With your current code, min/2 will be executed first then that result will be added to max.

Hope that makes sense.

I am unable to pass " `half(stats)` should be `28.015`" this part of the assignment

what’s your code now?

``````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 function does not return a value*, and you are still missing the parenthesis and your function is calculating `max + (min / 2)` because of operation precedence

* arrow functions have implicit return or explicit return

``````x => x+2 // implicit return
x => {return x + 2} // explicit return, if you use {} around the function body you must use return keyword
``````

Thank you @ieahleen,I corrected it.