Statistics Calculator User Made Instructions Step 22

The next step is to find the number in the middle of the list. If the list has an odd number of numbers, the middle number is the median. If the list has an even number of numbers, the median is the average of the two middle numbers.

You can check if a number is even or odd with the modulus operator, which is represented by the % symbol. This operator returns the remainder of the division of two numbers. If the remainder is 0, the number is even. If the remainder is 1, the number is odd:

array.length % 2 === 0;

CLARIFIED INSTRUCTIONS:
Declare a median variable and using a ternary operator, check if the array.length is even. If even, pass an array as an argument to the getMean function. Your argument should be comprised of the two separated middle numbers found indexed in sorted variable. If odd, locate the number at the middle index of the sorted array, remember to round down to find the correct indexed position.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.