Math.max() / Math.min()
Finds the maximum / minimum value.
Syntax
Math.max(a, b, ...) · Math.min(a, b, ...)
Description
Returns the largest or smallest number from the given numbers separated by commas. Use Math.max(...arr) for arrays.
Example
Loading editor…
Expected output
9 2
When to use?
Highest score, lowest price.