Objective

Create a function to multiply all the numbers in a given array and return the product.

Difficulty

Very easy

Description

Consider the following array of numbers:

var nums = [1, 5, 70, -2, -1, -0.5];

If we multiply all the numbers together, we get the value -350.

In this exercise, you ought to create a function multiplyAll() that takes in an array of numbers and returns back their product.

If the array is empty, the value returned should be null.

Here are some examples of the usage of the function:

multiplyAll([1, 5, 70, -2, -1, -0.5]);
-350
multiplyAll([2, 2, 2]);
8
multiplyAll([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
3628800
multiplyAll([]);
null