Question: Problem Results Array Properties & Methods 1 2 3 4 6 7 8 function main() { //take the number of passed levels var levels =

Problem Results Array Properties & Methods 1 2 3 4 6 7 8 function main() { //take the number of passed levels var levels = parseInt(readLine(), 10); var points = new Array(); var count = 0; while(count levels) { var elem = parseInt(readLine(),10); points [count] = elem; count++; } The player receives points after passing each level of a game. The program given takes the number of passed levels as input, followed by the points gained for each level, and creates the corresponding array of points. Complete the program to calculate and output to the console the sum of all gained points. 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 var sum = 0; var x; // calculate the sum of points while(x>0 && x
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
