Tell us what’s happening:
Describe your issue in detail here.
Your code so far
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 = (stats) => (stats.max + stats.min) / 2.0;
// Only change code above this line
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 YaBrowser/23.5.4.674 Yowser/2.5 Safari/537.36
Challenge: ES6 - Use Destructuring Assignment to Pass an Object as a Function’s Parameters
The line of code where (stats) is should be something like ({?+?}) instead. What they mean by turning an object into a function is something I`m not too familiar with most of the time you would have code like
Please make sure to provide a description of the issue you are experiencing in your own words. Being able to communicate issues is an important part of programming and helps others help you with troubleshooting.
Make sure to read the problem carefully. In this case, the problem is asking you to only send the max and min values to your function instead of the entire stats object. While your code is technically correct, it does not meet the requirements of the problem.
Use destructuring assignment within the argument to the function half to send only max and min inside the function.
Destructuring an object is when you “pull” out specific values by name instead of using the entire object. You can then reference those values as their own variables without needing to use the object.property syntax.
Let’s say you have a person object that looks like: