hi friends pls help me in JavaScript problem- var i = 0; do { print("This is iteration " + (i + 1) + "."); i++; } while( ); You can make sure a while loop runs once even if the condition never evaluates to true with a do/while loop. This ensures the code block runs at least once regardless of the condition's validity. Fix this do/while so it runs 4 times.
while(i < 4)
so the code should look like this: var i = 0; do { print("This is iteration " + (i + 1) + "."); i++; } while (i < 4);
thanx friend its working
<script type="text/javascript"> var i=0; do { document.write("This is iteration " + i + "."); document.write("<br />"); i++; } while (i<4); </script>
thanx doodletech
i < 4
well many beginner does the same mistake, they write i>4, take care and don2t do that simple mistake :D if loops are not same with while loops :D (as condition)
You study JavaScript on the Codecademy .com too:)
Actually i don not understand that clause really means TT
Join our real-time social learning platform and learn together with your friends!