Question: 5.What is a counter-driven loop? 6.Write a JavaScript function named countUp( ), which displays 1 to 10. 7.Modify the countUp( ) you wrote in the

5.What is a counter-driven loop?

6.Write a JavaScript function named countUp( ), which displays 1 to 10.

7.Modify the countUp( ) you wrote in the previous question to countUp( num), where num is a parameter. The function displays 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.";

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!