← Back to challenges

Find the Largest Number in an Array

JavaScriptHardarrayssortingnumbersloops

Instructions

Create a function that takes an array of numbers. Return the largest number 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).
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Video Streaming Plans