Transcript of the tutorial.
TOP
Okay then, gang.
So as we start to write more complex programs, there's going to be points in our code that we need
to either make some kind of decision on what to do next or maybe execute a piece of code over and over
and over.
We want to somehow control the flow of our code.
For example, if we have an array of data, for example, this array of names right here that we want
to maybe cycle through and perform some code on each element inside that array, then we would use what's
known as a loop.
A loop is a type of control flow in JavaScript.
Okay.
Likewise, at some point we might also want to check if a certain condition is met.
For example, is a user logged in or is a score of 100 and then only run some code when that condition
is true and this is known as a conditional statement.
So these two different concepts of looping and conditionals, they are collectively known as control
flow in JavaScript because we're using them to control the flow of our code or application, whether
that be using a loop to repeat a section of code or to conditionally run a section of code based on
a certain condition.
They're really important parts of the language and we're going to be using variations of them quite
a lot as we go through the course and make different projects.
So we'll be talking about these concepts and looking at the different kinds of loops and conditionals
for the rest of this chapter.