On this page
Math.min
Prev: floor | Up: Math | Next: random
Rel: Math, JSON, Math, BigInt & Date Guide
Ref: MDN Web Docs — Math.min
Tags: #public #web #javascript #builtins #math #tier/core
Signature & Overview
Math.min(...values) /* + Math.max(...values) */
Returns the smallest (or largest) of zero or more numbers (Infinity / -Infinity if empty).
Notes & Pitfalls
Math.min()with no args returnsInfinity, and spreading huge arrays (Math.min(...millionItems)) can throwRangeError: Maximum call stack size exceeded—use a loop for >50k items.
Example
console.assert(Math.min(5, 2, 9) === 2);
console.assert(Math.min(...[10, -3, 4]) === -3);
Linked from
Related notes
- tuts/javascript/builtins/Math/floor Linked here; links to this page; shared tags: #builtins, #javascript, #math, #tier, #web
- tuts/javascript/builtins/Math/random Linked here; links to this page; shared tags: #builtins, #javascript, #math, #tier, #web
- tuts/javascript/builtins/Math Linked here; links to this page; shared tags: #builtins, #javascript, #math, #web
- tuts/javascript/builtins/json_math_and_date Linked here; shared tags: #builtins, #javascript, #web
- tuts/javascript/builtins/Math/hypot shared tags: #builtins, #javascript, #math, #tier, #web
- tuts/javascript/builtins/Array/at shared tags: #builtins, #javascript, #tier, #web
- tuts/javascript/builtins/Array/filter shared tags: #builtins, #javascript, #tier, #web
- tuts/javascript/builtins/Array/find shared tags: #builtins, #javascript, #tier, #web
- tuts/javascript/builtins/Array/flatMap shared tags: #builtins, #javascript, #tier, #web
- tuts/javascript/builtins/Array/from shared tags: #builtins, #javascript, #tier, #web