Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidystephenson/56e7f290cdf2ce65d65a23d383f28613 to your computer and use it in GitHub Desktop.
Save davidystephenson/56e7f290cdf2ce65d65a23d383f28613 to your computer and use it in GitHub Desktop.
// 4. Write a program to find maximum number in a numeric array.
console.log("\n-------------------------------------------------\n");
var numbers = [0, 100, 5]
var maximum = numbers[0]
for (var number of numbers) {
if (number > maximum) {
maximum = number
}
}
console.log(maximum)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment