Skip to content

Instantly share code, notes, and snippets.

@mohitkh7
Created July 23, 2021 08:55
Show Gist options
  • Save mohitkh7/718e0930a9f7620fbfa533dd1bb925d9 to your computer and use it in GitHub Desktop.
Save mohitkh7/718e0930a9f7620fbfa533dd1bb925d9 to your computer and use it in GitHub Desktop.
solution for programming question
// 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