i have this code snippet. when i try to enter the code, it doesnt go through. on the console it says the first element passed to average() should be at the middle + 1 index of sorted array. but then it also says the first element passed to average() should be at the middle index of the sorted array…
So i wanted to know which is it supposed to be, cause im a little confused now.

Okay. Let’s figure this out left to right. The average function takes an array of numbers and returns the average. They sum the numbers up and divide by the length for you.

const average = nums => sum(nums) / nums.length;

So all you have to is pass in both numbers into a single array.

Going further right, I see you’re trying to take round the number in the sorted array at the index of middle. I don’t think that’s quite what the instructions are after. The middle index is calculated over here.

const middle = length / 2 - 1;

Sometimes when you divide, you get decimals. Arrays don’t know what decimals are, so you need to round that index up to the nearest whole number.

I hope this helps. Let me know if you need any further clarification.