course content

Course Content

Introduction to JavaScript

else ifelse if

Cool. Now we describe one case:

You can see that the a variable is greater than 10, and other messages (greater than 5 and greater than 0) make no sense.

You cannot just use the else statement because this case has few conditions.

else if

The else if construction provides a possibility to choose one block of execution:

Now we have a chain of conditions built, which is interrupted when at least one if gets true.

Note

This structure is useful when only one condition needs to be satisfied.

Section 4.

Chapter 3