Hi guys!
First time asking for help here. Not sure if this is the way, if it’s not please let me know and sorry in advance.
I have a quick question about an ES6 lesson which I am struggling to understand.
The lesson is:
After almost 25 minutes I managed to find that the solution is:
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
I’m really don’t understand why is this the solution, and why does this half variable understand that max and min are the ones inside the stats variable, as we are not saying that anywhere inside the arrow function. Does this work only for this lesson, because it’s prepared to understand that we refer to the stats variables or am I missing something?
Thanks!!