Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

thangeram

  • 3 years ago

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.

  • This Question is Closed
  1. agdgdgdgwngo
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    while(i < 4)

  2. agdgdgdgwngo
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    so the code should look like this: var i = 0; do { print("This is iteration " + (i + 1) + "."); i++; } while (i < 4);

  3. thangeram
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    thanx friend its working

  4. DoodleTech
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    <script type="text/javascript"> var i=0; do { document.write("This is iteration " + i + "."); document.write("<br />"); i++; } while (i<4); </script>

  5. thangeram
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    thanx doodletech

  6. KorcanKanoglu
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    i < 4

  7. KorcanKanoglu
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    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)

  8. Eminemhongsheng
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    You study JavaScript on the Codecademy .com too:)

  9. Eminemhongsheng
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Actually i don not understand that clause really means TT

  10. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Ask a Question
Find more explanations on OpenStudy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.