hello team, i am stuck here. i dont know what is wrong with my code. instruction was pretty clear, just that i dont know which part is wrong. have tried multiple ways of solution but none is helping.
can help to clarify to me which part i did wrong?
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const getVariance = (array) => {
const mean = getMean(array);
const sumSquaredDifferences = array.reduce((acc, el) => {
const difference = el - mean;
const squared = difference ** 2;
return acc + squared;
}, 0 / array.length);
return variance;
};
// 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/131.0.0.0 Safari/537.36
Challenge Information:
Learn Advanced Array Methods by Building a Statistics Calculator - Step 53
You aren’t need the above declaration. The instructions is asking only for: Divide your .reduce() call by the length of the array (in your variance declaration). Then, return variance.
Hint: you need to begun the new line of code after the closing round brace of your reduce method.