About 52 results
Open links in new tab
  1. Javascript, while loop return - Stack Overflow

    Aug 23, 2015 · Having a return statement directly inside a while loop will result in only one iteration being executed. (It makes your loop useless). However, if you replace this line with something like …

  2. declaration for variable in while condition in javascript

    Mar 9, 2017 · I was looking for 'why?' javascript doesn't allow const,let,var inside while conditionals and this answered my question. I always found it confusing that the console reported undefined when i …

  3. What is the JavaScript version of sleep ()? - Stack Overflow

    Jun 4, 2009 · The issue here is that JavaScript is a single-thread event-based model. While in a specific case, it might be nice to have the whole engine wait for a few seconds, in general it is bad practice. …

  4. javascript - The do-while statement - Stack Overflow

    Apr 8, 2011 · A Do/While executes the loop and then checks the conditions. For example, if the counterTwo variable was 10 or greater, then do/while loop would execute once, while your normal …

  5. multiple conditions within a while loop - Javascript

    multiple conditions within a while loop - Javascript Asked 10 years, 1 month ago Modified 3 years, 10 months ago Viewed 25k times

  6. Loop through an array in JavaScript - Stack Overflow

    Jun 10, 2010 · 133 In JavaScript it's not advisable to loop through an Array with a for-in loop, but it's better to use a for loop such as:

  7. javascript, while loop - Stack Overflow

    Aug 18, 2010 · i'm trying to get my script to wait for user input (click of a button) before continuing, this is v feasible in other languages, but seems impossible in js. basically, i want the user to select an ...

  8. javascript - How to use a while loop to prompt user until they enter 1 ...

    Mar 5, 2022 · I'm stuck on how to get this while loop to function properly. I want the program to prompt the user with a question 'Rock, paper, or scissors?' to which they can correctly enter 'rock', 'paper', '

  9. javascript - Understanding the while loop with value false - Stack …

    while(false) is a useless code because it won't output any or do any at all. The while() loop will always check for boolean conditions and that means that the statement inside it must return true or false.

  10. while (true) in javascript - how does it work - Stack Overflow

    Oct 25, 2018 · The "while true" loop in javascript runs without any conditions until the break/return statement executes inside the loop while loop only runs if the condition we write return a true, but …