### Tell us what’s happening:

Declare a `median`

variable. Using the ternary operator, check if the length of `array`

is even. If the length of `array`

is even, find the two middle numbers and calculate the mean of those numbers. If the length of `array`

is odd, find the middle number and assign it to the `median`

variable.

The hint has this part that i don’t understand:

Your first argument should be the value of `sorted`

at `array.length / 2`

, and the second at `array.length / 2 - 1`

.

i tried so many codes but still can’t pass it.

### Your code so far

```
const median = array.length % 2 === 0 ? getMean([Math.Floor(array.length / 2), Math.Floor(array.length / 2 - 1)]) : Math.floor(array.length / 2)
```

### Console log

If the `array.length`

is even, your `median `

variable should use the `getMean`

function to calculate the mean of the two middle numbers. Your first argument should be the value of `sorted`

at `array.length / 2`

, and the second at `array.length / 2 - 1`

. If the `array.length`

is odd, your `median`

variable should assign the middle number to the `median`

variable. The middle number is the value of `sorted`

at `Math.floor(array.length / 2)`

### Your browser information:

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0`

### Challenge Information:

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