Created
June 21, 2023 01:05
-
-
Save hoyangtsai/ac5907135f80db9168cec5d7eca2b369 to your computer and use it in GitHub Desktop.
#BigInt #math min function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function min(...values) { | |
if (values.length < 1) { | |
return Infinity; | |
} | |
let minValue = values.shift(); | |
for (const value of values) { | |
if (value < minValue) { | |
minValue = value; | |
} | |
} | |
return minValue; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
source: https://www.designcise.com/web/tutorial/what-is-the-math-min-alternative-for-bigint-values-in-javascript