Changed "statement" to "expression" (#39564)
The ternary operator doesn't allow statements, just expressions.pull/39570/head
parent
ae6cf5b724
commit
5cb609dc5c
|
@ -9,7 +9,7 @@ forumTopicId: 301181
|
|||
<section id='description'>
|
||||
The <dfn>conditional operator</dfn>, also called the <dfn>ternary operator</dfn>, can be used as a one line if-else expression.
|
||||
The syntax is:
|
||||
<code>condition ? statement-if-true : statement-if-false;</code>
|
||||
<code>condition ? expression-if-true : expression-if-false;</code>
|
||||
The following function uses an if-else statement to check a condition:
|
||||
|
||||
```js
|
||||
|
|
Loading…
Reference in New Issue