Tell us what’s happening:
I’m confused on which initial value to set to 0. Should it be in the sumSquaredDifferences variable or should it be in the callback function?
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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
Challenge Information:
Learn Advanced Array Methods by Building a Statistics Calculator - Step 48