Created
December 11, 2022 13:44
-
-
Save nextdev1111/cea7ba24a7ed9e9e429d0c4387aa3f12 to your computer and use it in GitHub Desktop.
Finding the max integer
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
x = findMax(1, 123, 500, 115, 44, 88); | |
function findMax() { | |
let max = -Infinity; | |
for (let i = 0; i < arguments.length; i++) { | |
if (arguments[i] > max) { | |
max = arguments[i]; | |
} | |
} | |
return max; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment