Doubt in code: Use Destructuring Assignment to Pass an Object as a Function's Parameters

Tell us what’s happening:
I’ve passed the situation with my code that is down below, but then I’ve changed it to the new values that I’ve assigned to each variable inside the Object and provides me with NaN.

I don’t understand why.

So I think I’ve passed with a bit of luck perhaps, because this seems way odd for me to understand why it didn’t worked out.

Attached I’ve got two print screens of the situation.

  **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 {max : maxValue, min: minValue} = stats;

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

// Only change code above this line

console.log(half(stats))


  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36

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

Link to the challenge:

Thanks for the reply RandellDawson

Now I understand better what I did :+1:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.