The browser storage localStorage is not available. Either your browser does not support it or you have disabled it or the maximum memory size is exceeded. Without localStorage your solutions will not be stored.

# min and max

The minimum and maximum of a set of numbers can be calculated with

`Math.min()`

and `Math.max()`

:
```
var min = Math.min(5, 7);
var max = Math.max(3, 9, 2);
```

`min`

receives the value `5`

and `max`

the value `9`

.
The special: Both functions can be called with an arbitrary number of arguments.## Exercise

Write a function

`midrange`

, that calculates the midrange of 3 numbers.
The midrange
is the mean of the smallest and largest number.
`midrange(3, 9, 1)`

should return `(9+1)/2`

= `5`

.
+ Hint

```
var midrange = function(a, b, c) {
var min = Math.min(a, b, c);
var max = Math.max(a, b, c);
...
};
```

+ Solution

```
var midrange = function(a, b, c) {
var min = Math.min(a, b, c);
var max = Math.max(a, b, c);
return (min + max) / 2;
};
```