JS Built-ins
← Math157 / 215
Mathmaxbeginner

Math.max() β€” All Negatives

πŸ“– 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: Use Math.max(-1, -5, -2) to find the maximum among negative numbers.

πŸ’‘ Hints (1)
  • β€’ -1 is the largest (closest to zero) among -1, -5, -2