...

/

The if, while, and do-while Statements

The if, while, and do-while Statements

In this lesson, you will have an overview of all flow-control statements provided by the JavaScript language.

📜NOTE: Control-flow statements have similar syntax and semantics to their pairs in C, C++, Java, and C#. This section gives you a very concise description of these statements and explains more details only upon uncommon constructs.

The if statement

The most common flow-control statement in almost every programming language is the if statement.

Illustration

Here is the concept explained in the form of an illustration:

Syntax

...