scrimba
Learn Modern JavaScript
Use Destructuring Assignment to Pass an Object as a Function's Parameters
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Use Destructuring Assignment to Pass an Object as a Function's Parameters
AboutCommentsNotes
Use Destructuring Assignment to Pass an Object as a Function's Parameters
Expand for more info
index.js
run
preview
console
const stats = {
max: 56.78,
standard_deviation: 4.34,
median: 34.54,
mode: 23.87,
min: -0.75,
average: 35.85
};
const half = (function() {

return function half(stats) {
return (stats.max + stats.min) / 2.0;
};

})();
console.log(stats);
console.log(half(stats));
Console
{max:
56.78
, standard_deviation:
4.34
, median:
34.54
, mode:
23.87
, min:
-0.75
, average:
35.85
}
,
28.015
,
index.html
-1:29