Skip to content

Instantly share code, notes, and snippets.

@amejiarosario
Last active January 10, 2020 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amejiarosario/2d4c0f3bdf3ed3ec2c342302dca158b3 to your computer and use it in GitHub Desktop.
Save amejiarosario/2d4c0f3bdf3ed3ec2c342302dca158b3 to your computer and use it in GitHub Desktop.
function findMax(n) {
let max;
let counter = 0;
for (let i = 0; i < n.length; i++) {
counter++;
if(max === undefined || max < n[i]) {
max = n[i];
}
}
return max;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment