Tell us what’s happening:
I am trying to complete this challenge by destructing the object inside the function call parameters but when I do so by using
return function half({
max : stats.max,
min : stats.min
})
but i get an error thrown in the console:
SyntaxError: unknown: Unexpected token, expected ,
Any suggestions on what might be happening
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
};
const half = (function() {
"use strict"; // do not change this line
// change code below this line
return function half({
max : stats.max,
min : stats.min
}) {
// use function argument destructuring
return (max + min) / 2.0;
};
// change code above this line
})();
console.log(stats); // should be object
console.log(half(stats)); // should be 28.015
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36
.
Link to the challenge: