course content

Course Content

Introduction to JavaScript

elseelse

if executes code under a certain condition, but it's not very similar to branching. The interpreter simply continues executing the code.

else

The else keyword is used in conjunction with if to create conditional statements.

Look at the example:

The else syntax is like the if syntax without a condition and parentheses ().

Note

If you include an else statement, you cannot place the end-of-command (;) after the if code block ({}), as doing so will result in a SyntaxError.

1. What will be the output?
2. What will be the output?

question-icon

What will be the output?

Select the correct answer

question-icon

What will be the output?

Select the correct answer

Section 4.

Chapter 2