Question: 5.Briefly describe how a while loop works. 6.What is a loop body? 7.What is a flag in JavaScript? 8.What does priming the loop mean? 9.
5.Briefly describe how a while loop works.
6.What is a loop body?
7.What is a flag in JavaScript?
8.What does "priming the loop" mean?
9.
What does the following code segment do?
var isSeven =false;
while ( isSeven==false ) {
var roll1=Math.floor(Math.random( )*6+1);
var roll2=Math.floor(Math.random( )*6+1);
if(roll1 + roll2 ==7) { isSeven = true; alert(roll1 +"--"+roll2); }
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
