Tell us what’s happening:
So I have finished this project. I ran it with the array of [1, 4, 6, 9].
I found bugs in mine -
- The median showed up 5 - there is no 5 in the array. I’m no statistics major for sure, so 5 is the “center” of the array, but not the middle number.
- The variance showed up 8.5 (but the value should be 5, how far values are from mean, on average. The farthest is 4 : 9-5 and 5-1)
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const mean = getMean(numbers);
const median = getMedian(numbers);
const mode = getMode(numbers);
const range = getRange(numbers);
const variance = getVariance(numbers);
document.querySelector("#mean").textContent = mean;
document.querySelector("#median").textContent = median;
document.querySelector("#mode").textContent = mode;
document.querySelector("#range").textContent = range;
document.querySelector("#variance").textContent = variance;
// 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/128.0.0.0 Safari/537.36
Challenge Information:
Learn Advanced Array Methods by Building a Statistics Calculator - Step 58