Objective

Given an array of numbers, find the minimum.

Difficulty

Very easy

Description

In a list of numbers, the smallest number is often referred to as the minimum.

In this exercise, you have to create a function min() to find and return the minimum element of a given array of numbers.

Here's the signature of the function:

function min(arr) {
   // Your code here.
}

arr is the array whose minimum we ought to find.

If the given array is empty, return the special number Infinity; otherwise return the minimum value.

Hints