Conditional and Loop Flow
Statements in JavaScript are processed sequentially in the order they're loaded. That order can be changed with conditional and loop code statements. The different parts of a control statement are as follows:
- Code blocks
{…}
- Conditional flow statements, such as
if...else, switch, try catch finally
- Loop statements, such as
for, do...while, while, for...in, and for...of
- Other control statements, such as
labeled
,break
, andcontinue
We will describe each of these in detail in the next section.
Code Blocks
Code blocks are statements that are placed between an open and close curly bracket. The syntax is as follows:
//Code block { //Statement //Statement //Statement }
Code blocks by...