To know what object is being used for the destructuring you have to look at the function call.
half(stats);
You know what stats is by looking at the code (i.e. an object) and by looking at the function definition you can see which properties are being used for the parameters.
I assume by “it” you mean the runtime. The runtime “knows” it because the function is passed the object as an argument.
this function is meant to work with any object which holds the properties max and min. Even before you edit the entries, it was not associated with the stats object. Its properties and argument were called stats, but they were local