Методы математического объекта - math.min () и math.max ()

console.log(Math.min(1, 2, 3));  // 1
console.log(Math.max(1, 2, 3));  // 3

// If one of the objects can't be converted, the result is NaN:
console.log(Math.min(1, 2, 'Hello!'));  // NaN
console.log(Math.max(1, 2, 'Hello!'));  // NaN

// If you give .min() nothing, you get Infinity:
console.log(Math.min());  // Infinity

// If you give .max() nothing, you get -Infinity:
console.log(Math.max());  // -Infinity
Gorgeous Goldfinch