The Score Summation
EasyAcc. 98.5%
+15 XP 5
Total Accumulation
In data processing, summing a list of values is the most fundamental operation.
The Assignment
Your function receives an array parameter scores.
- Initialize a variable
totalto 0. - Use a
forloop to iterate through every element in thescoresarray. - In each step, add the current score to
total. - Print the final
total.
01EXAMPLE 1
Input
scores = [5, 12, 8, 15]Output
40Explanation: 5 + 12 + 8 + 15 = 40.
Constraints
- Use a manual for loop.
- Do not use .reduce().
ArraysLoopsBasics
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
scores[5,12,8,15]
Expected Output
40
Click RUN to test your solution