Created
July 23, 2021 08:55
-
-
Save mohitkh7/718e0930a9f7620fbfa533dd1bb925d9 to your computer and use it in GitHub Desktop.
solution for programming question
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
// Q2. Write a function to get Max value of a number Array? | |
function findMax(arr) { | |
maxValue = arr[0]; | |
arr.forEach(element => { | |
if (element >= maxValue) { | |
maxValue = element; | |
} | |
}); | |
return maxValue; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment