--- id: 635080d80b72803e973841da title: Step 11 challengeType: 0 dashedName: step-11 --- # --description-- Like the other methods, `.reduce()` takes a callback. This callback, however, takes at least two parameters. The first is the accumulator, and the second is the current element in the array. The return value for the callback becomes the value of the accumulator on the next iteration. ```js array.reduce((acc, el) => { }); ``` For your `sum` variable, pass a callback to `.reduce()` that takes the accumulator and the current element as parameters. The callback should return the sum of the accumulator and the current element. # --hints-- Your `reduce` method should have a callback function which takes an `acc` and an `el` parameters. ```js assert.match(getMean.toString(), /(array\.reduce\(\s*\(\s*acc\s*,\s*el\s*\)\s*=>|array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{)/) ``` Your `reduce` method should return the sum of `acc` and `el`. ```js assert.match(getMean.toString(), /(array\.reduce\(\s*\(\s*acc\s*,\s*el\s*\)\s*=>|array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{)\s*(return\s+)?\s*acc\s*\+\s*el/) ``` # --seed-- ## --seed-contents-- ```html Statistics Calculator

Statistics Calculator

Enter a list of comma-separated numbers.

The mean of a list of numbers is the average, calculated by taking the sum of all numbers and dividing that by the count of numbers.

Mean:

The median of a list of numbers is the number that appears in the middle of the list, when sorted from least to greatest.

Median:

The mode of a list of numbers is the number that appears most often in the list.

Mode:

The range of a list of numbers is the difference between the largest and smallest numbers in the list.

Range:

The variance of a list of numbers measures how far the values are from the mean, on average.

Variance:

The standard deviation of a list of numbers is the square root of the variance.

Standard Deviation:

``` ```css body { margin: 0; background-color: rgb(27, 27, 50); text-align: center; color: #fff; } button { cursor: pointer; background-color: rgb(59, 59, 79); border: 3px solid white; color: white; } input { background-color: rgb(10, 10, 35); color: white; border: 1px solid rgb(59, 59, 79); } .bold { font-weight: bold; } ``` ```js --fcc-editable-region-- const getMean = (array) => { const sum = array.reduce(); } --fcc-editable-region-- const calculate = () => { const value = document.querySelector("#numbers").value; const array = value.split(/,\s*/g); const numbers = array.map(el => Number(el)).filter(el => !isNaN(el)); } ```