ES6 Destructuring- How does this code know to retrieve values from another object(stat)?

Destructuring is like an object filter, you pass anything with {min, max} keys, and get those variables.

If you look at the bottom left corner, they call the function to test the code

half(stats)

So that’s when the filtering happens, and you extract min and max, if they exist in the stats object…


tbh, there are so many exact same questions as you that probably the exercise is just unclear. But remember you should search before asking. Well, it will be quicker for you:

example