The construct else
is optional.
The following example will print a message
to the console only if the value of the
variable is 1
. Otherwise,
nothing will just happen:
let test = 1;
if (test == 1) {
console.log('+++');
}
Check if the variable test
is equal
to 10
, then let's print 'yes'
.
Otherwise, let nothing happen.