+ 1

Loops

I'm struggling with creating a looping code where the user is prompted for 4 values and those values are displayed back in an alert

12th Apr 2018, 10:42 PM
love
5 Respuestas
+ 1
How do I post the last loop as an alert?
12th Apr 2018, 11:15 PM
love
+ 1
if you use a for loop, use the count of the variable.. for(var i=0; i<5; i++){ //take input If(i==5){ //print alert { } something like this
13th Apr 2018, 1:21 AM
LordHill
LordHill - avatar
0
I assume JS? Have you tried running a loop and putting the input into an array, then on its last loop posting it into an alert?
12th Apr 2018, 11:05 PM
LordHill
LordHill - avatar
0
Thanks. How do I calculate the averages of the inputs using loops and array
14th Apr 2018, 12:02 AM
love
0
well, if you have an array of numbers, you can iterate thru it with a loop. a for each loop perhaps.. each iteration, add the next value of the array to an integer and after the last one is added, divide the total by the length of the array
14th Apr 2018, 3:43 AM
LordHill
LordHill - avatar