Write a function max that calculates the maximum of an arbitrary number of numbers. code example | Newbedev

PHOTO EMBED

Sat Dec 04 2021 20:56:51 GMT+0000 (Coordinated Universal Time)

Saved by @tolanisirius

x = findMax(1, 123, 500, 115, 44, 88);

function findMax() {
  var i;
  var max = -Infinity;
  for (i = 0; i < arguments.length; i++) {
    if (arguments[i] > max) {
      max = arguments[i];
    }
  }
  return max;
}
content_copyCOPY

https://newbedev.com/typescript-write-a-function-max-that-calculates-the-maximum-of-an-arbitrary-number-of-numbers-code-example