in JavaScript by
Which one of the following is the correct output for the given JavaScript code?

var a=0;  

var b =0;  

while (a <3)  



    b += a;  



a) 136

b) 123

c) 013

d) 01

1 Answer

0 votes

Answer: A

Reason: In the "while" loop statement, the condition is first checked before executing the statements written in the loop's body. Generally, the value of the counter variable incremented at the end of the body of the "while" loop, whereas the statements are executed first.

Related questions

0 votes
asked Mar 21 in JavaScript by rajeshsharma
0 votes
asked Mar 23 in JavaScript by sharadyadav1986