Learn Advanced Array Methods by Building a Statistics Calculator - Step 49

Tell us what’s happening:

The test outputs to the console: Your reduce callback should return the sum of acc and el. But the function returns the sum of acc and el. I’ve used explicit and implicit returns

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

const getVariance = (array) => {
  const mean = getMean(array);
  const differences = array.map(
    el => el - mean
  );
  const squaredDifferences = differences.map(
    el => el ** 2
  );

const sumSquaredDifferences = squaredDifferences.reduce((acc, el) => acc + el);

}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36

Challenge Information:

Learn Advanced Array Methods by Building a Statistics Calculator - Step 49

You are missing

Remember to set the initial value to 0 .