Learn about the other most common way of looping.
- [Instructor] In this video,…we're going to talk about one more kind…of loop called the while loop.…To set up a comparison, let's look at a for loop first.…This is the sequential for loop we've seen before…where we have initialize variable,…some bound where it should stop,…and the way that we get to that bound.…Then, inside the curly braces, we take some actions.…This is the same thing expressed as a for loop.…I'm initializing a variable…and then I have the keyword while,…and then in the parentheses is my terminating condition.…
Then, inside these curly braces,…this will keep happening over and over again,…whatever is in here,…until I reach this terminating condition.…To make sure I reach it,…I include my incrementing inside the curly braces.…These two loops do exactly the same thing.…I'm going to copy this over into my browser just to prove…that it works.…There we go, zero through nine,…just like we would have done with that for loop.…This might raise the question,…why would you use a while loop…when you could just use a for loop or vice versa even?…
- Using a text editor
- Declaring and assigning variables
- Booleans and the quest for truth
- Working with objects and arrays
- Using operators and control structures
- Iterating with loops
- Objects, references, and functions
- Promises, async, and await
Skill Level Beginner
1. Getting Started
2. Variables and Types
3. Objects, Arrays, and More
4. Operators and Control Structures
5. Iterating with Loops
7. More Advanced Pieces
Next steps3m 38s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.