January 2018
Intermediate to advanced
678 pages
20h 16m
English
do LoopAs mentioned earlier, JavaScript has three types of loops—the while loop, do loop, and for loop. Next up—the do loop.
Note the do loop’s syntax template at the left of FIGURE 10.6. It shows the do loop’s condition at the bottom. That contrasts with the while loop, where the condition is at the top. Having the condition tested at the bottom guarantees that the do loop executes at least one time. After all, the condition is the only way to terminate the loop, and the JavaScript engine won’t check the condition (at the bottom) until after executing the lines above it. In the syntax template, note the semicolon at the right of the condition. That’s also different from the while loop. Finally, note that the ...
Read now
Unlock full access