+ 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
5 Réponses
+ 1
How do I post the last loop as an alert?
+ 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
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?
0
Thanks. How do I calculate the averages of the inputs using loops and array
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