--- id: 635085f80bd9b5429faa40c4 title: Step 15 challengeType: 0 dashedName: step-15 --- # --description-- You can actually clean this logic up a bit. Using the implicit return of an arrow function, you can directly return the value of the `.reduce()` method divided by the length of the array, without having to assign any variables. Update your `getMean` function as described above. # --hints-- You should remove the `sum` variable declaration. ```js assert.notMatch(getMean.toString(), /sum\s*=/); ``` You should remove the `mean` variable declaration. ```js assert.notMatch(getMean.toString(), /mean\s*=/); ``` You should not change the logic within the `reduce` method. ```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\s*;?\s*\}?\s*,\s*0\s*\)/) ``` You should divide the result of the `reduce` method by the length of the array. ```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\s*;?\s*\}?\s*,\s*0\s*\)\s*\/\s*array\.length/) ``` You should use implicit return syntax to directly return the result of `reduce` divided by the array length. ```js assert.match(code, /const\s+getMean\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*array\.reduce\(\s*\(\s*acc\s*,\s*el\s*\)\s*=>\s*acc\s*\+\s*el\s*,\s*0\s*\)\s*\/\s*array\.length/) ``` # --seed-- ## --seed-contents-- ```html
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: