JS Built-ins
← Math164 / 215
Mathminintermediate

Math.min() β€” With -Infinity

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

Use Math.min() to find the smallest value among a set of numbers, or to clamp a maximum bound.

Math.min()

Returns the smallest of the given numbers.

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

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