Find the Largest Number in an Array

Published by Matt in

Create a function that takes an array of numbers. Return the largest number in the array.

Examples

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

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

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

Notes

  • Expect either positive numbers 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.