Find the Largest Number in an Array

Published by kochug in

Create a method that takes an array of integers. Return the largest integer in the array.

Examples

findLargestNum([4, 5, 1, 3]) ➞ 5

findLargestNum([300, 200, 600, 150]) ➞ 600

findLargestNum([1000, 1001, 857, 1]) ➞ 1001

Notes

  • Expect either a positive number or zero (there are no negative numbers).
  • If you get stuck on a challenge, find help in the Resources tab.
  • If you're really stuck, unlock solutions in the Solutions tab.
Watch a quick demo on how Edabit works.