Destructuring assignment to pass Object

Basically, I’ve been unable to destructure the properties of the object below as a function’s parameters.

const stats = {
  max: 56.78,
  standard_deviation: 4.34,
  median: 34.54,
  mode: 23.87,
  min: -0.75,
  average: 35.85

const half = (function() {
  "use strict"; // do not change this line

  // change code below this line
  return function half({ max, min }) {
    // use function argument destructuring
    return (max + min) / 2.0;
  // change code above this line

if this is a challenge onto FCC please provide us with the link :3

The starting challenge code does not have such a structure. I assume you were copying/pasting from one of the solutions showing after clicking the Get a hint button. Those were outdated solutions from when the challenge was different. I have updated the solution to reflect the current version of the challenge. You should be using arrow function syntax as the original challenge seed showed.


I did try the arrow function syntax but the challenge was not resolved. Here is the link to the challenge:

always show your code if you want help with it, we can on help with what we see

the starting code is

const half = (stats) => (stats.max + stats.min) / 2.0;

you need to change the minimum necessary to pass the challenge

1 Like

Thanks man, I have realized my flaws.