Question: 1. What is the value of variable num after the following code segment is executed? var num = 10; while ( num <10) { num

1.

What is the value of variable num after the following code segment is executed?

var num = 10;

while ( num <10) {

num = num +1;

}

2.

ar count = 10;

while (count>0) {

count = count -2;

}

What is the value of count after the code segment above is executed?

3.What is an infinite loop? How to avoid i?

4.

What's wrong with the following code segment? How to fix it?

var num = 10;

while ( num > 0 ) {

document. getElementById("outputDiv").innerHTML = document. getElementById("outputDiv").innerHTML +" "+num + " "; }

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!