Tell us what’s happening:
Forgive me for my bad English ! I finished this question. But the answer is different from mine.
get a hint answer :
return (({max, min}) => {return (max + min) / 2.0;});
why not :
return ({max, min}) => {return (max + min) / 2.0;};
Why return add a parenthesis? Is it necessary? Should I worry about it?
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 ({max,min}) => (max+min)/2;
// 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 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters/