@ -2,7 +2,8 @@
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
```js
if (condition) {
statement1
} else {
@ -11,5 +12,5 @@ if (condition) {
```
< ResourceGroupTitle > Free Content< / ResourceGroupTitle >
< BadgeLink colorScheme = 'yellow' badgeText = 'Read' href = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else' > if...else< / BadgeLink >
< BadgeLink colorScheme = 'yellow' badgeText = 'Read' href = 'https://javascript.info/ifelse' > Conditional branching: if, '?'< / BadgeLink >
< BadgeLink colorScheme = 'yellow' badgeText = 'Read' href = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else' > if...else - MDN docs < / BadgeLink >
< BadgeLink colorScheme = 'yellow' badgeText = 'Read' href = 'https://javascript.info/ifelse' > Conditional branching: if, '?' - javascript.info < / BadgeLink >