The Multiplier Effect
EasyAcc. 96.8%
+15 XP 5
Compound Product
Like summation, but with multiplication.
The Assignment
Your function receives an array factors.
- Initialize
productto 1. - Iterate through the array and multiply each value to
product. - Print the result.
- If the array is empty, print 0.
01EXAMPLE 1
Input
factors = [2, 3, 4]Output
24Explanation: 2 * 3 * 4 = 24.
Constraints
- Ensure the initial value is 1 (not 0).
- Handle empty arrays correctly.
ArraysLoopsMath
JavaScriptSystem handles I/O — write your function only
Loading...
2 Hidden
Input Arguments
factors[2,3,4]
Expected Output
24
Click RUN to test your solution