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():
let min = Math.min(5, 7);
let 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.

Example: midrange(3, 9, 1) should return (9+1)/2 = 5.
function midrange(a, b, c) {
  let min = Math.min(a, b, c);
  let max = Math.max(a, b, c);
  ...
}
function midrange(a, b, c) {
  let min = Math.min(a, b, c);
  let max = Math.max(a, b, c);
  return (min + max) / 2;
}

loving