Question: Predict the output sequences that would be produced by each of the following while loops: count = 10; while (count > 0) { document.getElementById('outputDiv').innerHTML =
Predict the output sequences that would be produced by each of the following while loops:
count = 10;
while (count > 0) {
document.getElementById('outputDiv').innerHTML =
document.getElementById('outputDiv').innerHTML + count + '
';
count = count - 2;
}
document.getElementById('outputDiv').innerHTML =
document.getElementById('outputDiv').innerHTML + 'DONE WITH 1ST!
';
num = 1;
while (num <= 5) {
document.getElementById('outputDiv').innerHTML =
document.getElementById('outputDiv').innerHTML + num + '
';
num = num + 1;
}
document.getElementById('outputDiv').innerHTML =
document.getElementById('outputDiv').innerHTML + 'DONE WITH 2ND!
';
x = 1;
y = 10;
while (x < y) {
document.getElementById('outputDiv').innerHTML =
document.getElementById('outputDiv').innerHTML + x + ' ' + y + '
';
x = x + 1;
y = y - 2;
}
document.getElementById('outputDiv').innerHTML =
document.getElementById('outputDiv').innerHTML + 'DONE WITH 3RD!
';
Step by Step Solution
3.52 Rating (159 Votes )
There are 3 Steps involved in it
10 8 6 4 2 DONE ... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (1 attachment)
1409-C-S-O-S(1086).docx
120 KBs Word File
