Loops
In this course, you will learn how to use for and while loops to execute blocks of code multiple times.
StartKey Concepts
Review core concepts you need to learn to master this subject
While Loop
Reverse Loop
Do…While Statement
For Loop
Looping Through Arrays
Break Keyword
Nested For Loop
Loops
While Loop
While Loop
while (condition) {
// code block to be executed
}
let i = 0;
while (i < 5) {
console.log(i);
i++;
}
The while
loop creates a loop that is executed as long as a specified condition evaluates to true
. The loop will continue to run until the condition evaluates to false
. The condition is specified before the loop, and usually, some variable is incremented or altered in the while
loop body to determine when the loop should stop.
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory