Basic If Else Statement

Loris
1 min readJul 8, 2017

--

If Else statement is one of the most used conditional statement in programming language and of course also JavaScript.

This very useful statement is composed by 3 parts:

The “If” keyword that tell to the JavaScript interpreter that the code after it is a if statement.

The condition that can returns true or false.

The code block that will run after evaluating the condition.

The condition can be composed by 2 or more element that will be compared with comparison operator or logical operator.

If the condition is true then the if code block (code block after the condition) will run.

If the condition is false then the JavaScript interpreter will skip the “if code block” and will run the “else code block” (code block after the keyword “else”).

--

--