JS Built-ins
← Math165 / 215
Mathminintermediate

Math.min() β€” With NaN

πŸ“– 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: Observe that Math.min(1, NaN) returns NaN.

πŸ’‘ Hints (1)
  • β€’ Any comparison involving NaN produces NaN