# Learn Advanced Array Methods by Building a Statistics Calculator - Step 27

### Tell us what’s happening:

I do not understand the instructions . so I do not know what to do

``````/* file: script.js */
const getMean = (array) => array.reduce((acc, el) => acc + el, 0) / array.length;

const getMedian = (array) => {
const sorted = array.sort((a, b) => a - b);
const median =
array.length % 2 === 0
? getMean([sorted[array.length / 2], sorted[array.length / 2 - 1]])
: sorted[Math.floor(array.length / 2)];
return median;
}

// User Editable Region

const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] += 1;
})
}

// User Editable Region

const calculate = () => {
const value = document.querySelector("#numbers").value;
const array = value.split(/,\s*/g);
const numbers = array.map(el => Number(el)).filter(el => !isNaN(el));

const mean = getMean(numbers);
const median = getMedian(numbers);

document.querySelector("#mean").textContent = mean;
document.querySelector("#median").textContent = median;
}
``````

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36`

### Challenge Information:

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

There is currently an open issue to update this step since it only accepts one fixed solution.

You can see the answer there to move onto the next step which it is going to be pretty difficult for most beginners to arrive at that one solution on their own.

But to understand how this is supposed to work, you should read through this other thread which walks through what is happening

Hope that helps

2 Likes

thank you so much (some unnecessary characters for my thanks reply to exceed 20 characters )

1 Like