the solution for this deconstruction problem is incomplete! it requires another step for the instruction to be useable. the student must understand that the current ‘solution’ doesn’t work in a real-world use scenario because THERE IS NO WAY FOR half
TO KNOW THAT stats
IS BEING PASSED INTO IT!!
a simple, more complete, solution to this would be something like this:
const stats = {
max: 56.78,
standard_deviation: 4.34,
median: 34.54,
mode: 23.87,
min: -0.75,
average: 35.85
};
const half = ({max,min}) => (max + min) / 2.0;
console.log(half(stats)); // <--------- add this
i’ve come across several such ‘solutions’ and finally had to say something. the novice student may use this as reference and may not connect the necessary dots to get this to work. which means they’re frustrated and that’s not useful when learning.
plus it’s just NOT COMPLETE.
ahem. please fix.