5.What is a counter-driven loop?
6.Write a JavaScript function named countUp( ), which displays 1to 10.
7.Modify the countUp( ) you wrote in the previous question tocountUp( num), where num is a parameter. The functiondisplays from 1 to num.
8.
What does the following code segment do?
var count =0;
var sevens =0 ;
while(count<100)
{
var roll1 = Math.floor(Math.random()*6+1);
var roll2 = Math.floor(Math.random()*6+1);
if(roll1 + roll2 == 7)
sevens = sevens +1;
}
document.getElementById(“outputDiv”).innerHTML =”Seven appears”+sevens +” times.”;
Expert Answer
An answer will be send to you shortly. . . . .