JS Built-ins
← Math159 / 215
Mathmaxintermediate

Math.max() β€” With Infinity

πŸ“– Usage Example
// Largest of the given numbers
Math.max(1, 5, 3)   // β†’ 5
Math.max(-1, -5)    // β†’ -1

Use Math.max() to find the largest value among a set of numbers, or to clamp a minimum bound.

Math.max()

Returns the largest of the given numbers.

Challenge: Verify that Math.max(Infinity, 1) returns Infinity.

πŸ’‘ Hints (1)
  • β€’ Infinity is larger than any finite number