ES6 - Use Destructuring Assignment to Pass an Object as a Function's Parameters

Tell us what’s happening:

Describe your issue in detail here.
How does the half function know from what object it needs to pick the value

Every time it pick from the stats object. If I comment it then it gives no output.

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
};

const anotherStats = {
  max: 100,
  standard_deviation: 4.34,
  median: 34.54,
  mode: 23.87,
  min: 10,
  average: 35.85
};

// Only change code below this line
// const half = (stats) => (stats.max + stats.min) / 2.0; 
const half = ({min, max}) => console.log((max + min) / 2.0); 

// 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/120.0.0.0 Safari/537.36 Edg/120.0.0.0

Challenge Information:

ES6 - Use Destructuring Assignment to Pass an Object as a Function’s Parameters

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

I think thats because you have not specified from which object the min and the max values are from

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