The Multiplier Effect

EasyAcc. 96.8%
+15 XP 5

Compound Product

Like summation, but with multiplication.

The Assignment

Your function receives an array factors.

  1. Initialize product to 1.
  2. Iterate through the array and multiply each value to product.
  3. Print the result.
  4. If the array is empty, print 0.

01EXAMPLE 1

Inputfactors = [2, 3, 4]
Output24

Explanation: 2 * 3 * 4 = 24.

Constraints

  • Ensure the initial value is 1 (not 0).
  • Handle empty arrays correctly.
ArraysLoopsMath
JavaScript
Loading...
2 Hidden

Input Arguments

factors[2,3,4]

Expected Output

24

Click RUN to test your solution