mirror of
https://github.com/Fechin/reference.git
synced 2026-11-20 21:23:11 +03:00
Merge pull request #717 from ibdul/js-ternary
feat: add improved comments to js ternary op
This commit is contained in:
1 file changed
+3
-1
@@ -152,9 +152,11 @@ if (isMailSent) {
|
||||
### Ternary Operator
|
||||
|
||||
```javascript
|
||||
// The ternary operator is a concise way to write an if-else statement in a single line: condition ? exprIfTrue : exprIfFalse.
|
||||
|
||||
var x = 1;
|
||||
|
||||
// => true
|
||||
// true, (condition) ? value_if_true : value_if_false
|
||||
result = x == 1 ? true : false;
|
||||
```
|
||||
|
||||
|
||||
Reference in new issue
Block a user