Skip to content

Instantly share code, notes, and snippets.

@nextdev1111
Created December 11, 2022 13:44
Show Gist options
  • Save nextdev1111/cea7ba24a7ed9e9e429d0c4387aa3f12 to your computer and use it in GitHub Desktop.
Save nextdev1111/cea7ba24a7ed9e9e429d0c4387aa3f12 to your computer and use it in GitHub Desktop.
Finding the max integer
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