Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started