Last active
January 10, 2020 23:24
-
-
Save amejiarosario/2d4c0f3bdf3ed3ec2c342302dca158b3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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