Conditionals in JavaScript
Introduction to the syntax and semantics of conditionals in JavaScript.
We'll cover the following...
Conditionals features
A program conditional has the following:
- A condition which can be
true
orfalse
- A program block executed when the condition is
true
- A program block executed when the condition is
false
With these features in mind, let’s map them to the corresponding JavaScript syntax.
Keywords and semantics
In JavaScript, a conditional statement consists of various properties and keywords.
if
condition
The if-condition is the starting point of a conditional. The syntax is as ...