0
How to design a javascript program that stores an array.
Write a javascript program that asks the user to enter up to 10 golf scores, which are to be stored in an array. You should provide a means for the user to terminate input prior to entering 10 scores. The program should display all the scores on one line and report the average score. Handle input, display, and the average calculation with three separate array processing functions.
1 ответ
+ 1
var array = [];
var in,x=1;
alert("enter 10 scores");
//to store value
while(array.length !=10){
in=parseInt(prompt(x));
array.push(in);
x++;
}
//to print the array
for(var i =0; i<array.length;i++){
document.write(array[i]));
}
Is that all?