I dont understand this solution. The task: Use destructuring assignment within the argument to the function half
to send only max
and min
inside the function.
The solution is listed below. But how can this be the solution when the solution doesnt even reference the “stats” object? What if theres another object that also contains both “max” and “min” properties?
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 browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0
Challenge: ES6 - Use Destructuring Assignment to Pass an Object as a Function’s Parameters
Link to the challenge: