Select the correct output for the following code : for(var b=3,d=0; d<3; d++) b+=1; document.write(b);
Answers
Answered by
0
Answer:
Not definite as the variable b is not declared outside the for loop scope
Explanation:
The declaration of variable b is inside the for loop so when the loop gets executed, the value of b becomes '6' but, as the values printed is outside the for loop, b will not be accessible to it.
but, if you include that document.write inside the for loop then the output will be
'456'
Similar questions