Find the Smallest Number in an Array

Published by Matt in

Create a method that takes an array of integers and returns the smallest number in the set.

Examples

findSmallestNum([34, 15, 88, 2]) ➞ 2

findSmallestNum([34, -345, -1, 100]) ➞ -345

findSmallestNum([7, 7, 7]) ➞ 7

Notes

  • Test cases contain only positive and 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.