About 715,000 results
Open links in new tab
  1. If vs. while in specific JavaScript code - Stack Overflow

    Feb 24, 2012 · var target = event.target || event.srcElement; while (target && target.nodeType != 1) { target = target.parentNode; return target; You do realize that while is a loop, right? It will …

  2. What's the difference between an if and while statement

    Meaning an if statement gives you once the possibility to do something or not (or something else). Whereas a while loop does things as long as the condition is true. Here in the simple exercises …

  3. JavaScript While Loop - W3Schools

    The while loop loops through a block of code as long as a specified condition is true. In the following example, the code in the loop will run, over and over again, as long as a variable (i) …

  4. Control Structures (if/else, for and while loops) Code of Code

    There are several control structures in JavaScript, including if/else statements, for loops, and while loops. In this article, we’ll go over the basics of each of these control structures and how …

  5. If statement inside while loop - JavaScript - The freeCodeCamp …

    Oct 8, 2020 · while (count < 50) { if (count % 3 === 0 && count % 5 === 0){ console.log(count); } count++; } Your count = 5 initially, when it enters loop, if condition return false and comes out …

  6. Difference between an If statement and While loop

    A while loop will run as many times as it needs to while a condition is true, i.e., until that condition is false. An if statement will execute once if a condition is true. A great way to understand …

  7. Javascript While loops, explained by DJ Snake & Lil’ John.

    Jun 14, 2017 · Unlike an if and a while loop, which go through the condition first, and then execute a code block based on whether that condition is true. A do/while loop will always execute the …

  8. what's the main difference between "if" and "while"? - Treehouse

    I don't understand why it does not work when I use "while" instead of "if" for: if (!isEmpty()) { mPezCount--;} . and Will using a do while loop work, for example: do {mPezCount--;} while …

  9. How to Understand the Difference Between If Statements and While

    Oct 13, 2020 · For beginners, whichever programming language you are learning, it might be difficult to distinguish between an if statement and a while loop. In this blog post, I’ll take …

  10. JavaScript while Statement - W3Schools

    The while statement creates a loop (araund a code block) that is executed while a condition is true. The loop runs while the condition is true. Otherwise it stops.

  11. Some results have been removed
Refresh