Tell us what’s happening:
help~
Your code so far
// User Editable Region
const median = nums => {
const sorted = nums.slice().sort((a, b) => a - b);
const length = sorted.length;
const middle = length / 2 - 1;
return isEven(length) ? average([sorted[middle], sorted[middle + 1]]) : Math.ceil(sorted[middle]);
}
// 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/122.0.0.0 Safari/537.36 Edg/122.0.0.0
Challenge Information:
Learn Functional Programming by Building a Spreadsheet - Step 25