Roadmap to becoming a developer in 2022
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

639 B

If else

The if statement executes a statement if a specified condition is truthy. If the condition is falsy, another statement in the optional else clause will be executed.

Example

if (condition) {
  statement1
} else {
  statement2
}

Free Content if...else - MDN docs Conditional branching: if, '?' - javascript.info