Fix example comment spacings (#23792)
This commit is contained in:
committed by
Manish Giri
parent
f169c1df26
commit
521138726b
@ -13,13 +13,13 @@ If the first evaluates as ["falsy"](https://developer.mozilla.org/en-US/docs/Glo
|
|||||||
|
|
||||||
When only involving boolean values (either `true` or `false`), it returns true if only if both expressions are true. If one or both expressions are false, the entire statement will return false.
|
When only involving boolean values (either `true` or `false`), it returns true if only if both expressions are true. If one or both expressions are false, the entire statement will return false.
|
||||||
```js
|
```js
|
||||||
true && true //returns the second value, true
|
true && true //returns the second value, true
|
||||||
true && false //returns the second value, false
|
true && false //returns the second value, false
|
||||||
false && false //returns the first value, false
|
false && false //returns the first value, false
|
||||||
123 && 'abc' // returns the second value, 'abc'
|
123 && 'abc' //returns the second value, 'abc'
|
||||||
'abc' && null //returns the second value, null
|
'abc' && null //returns the second value, null
|
||||||
undefined && 'abc' //returns the first value, undefined
|
undefined && 'abc' //returns the first value, undefined
|
||||||
0 && false //returns the first value, 0
|
0 && false //returns the first value, 0
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Logical OR ( || )
|
#### Logical OR ( || )
|
||||||
@ -28,13 +28,13 @@ The OR operator compares two expressions. If the first evaluates as "falsy", the
|
|||||||
|
|
||||||
When only involving boolean values (either `true` or `false`), it returns true if either expression is true. Both expressions can be true, but only one is needed to get true as a result.
|
When only involving boolean values (either `true` or `false`), it returns true if either expression is true. Both expressions can be true, but only one is needed to get true as a result.
|
||||||
```js
|
```js
|
||||||
true || true //returns the first value, true
|
true || true //returns the first value, true
|
||||||
true || false //returns the first value, true
|
true || false //returns the first value, true
|
||||||
false || false //returns the second value, false
|
false || false //returns the second value, false
|
||||||
123 || 'abc' // returns the first value, 123
|
123 || 'abc' //returns the first value, 123
|
||||||
'abc' || null //returns the first value, 'abc'
|
'abc' || null //returns the first value, 'abc'
|
||||||
undefined || 'abc' //returns the second value, 'abc'
|
undefined || 'abc' //returns the second value, 'abc'
|
||||||
0 || false //returns the second value, false
|
0 || false //returns the second value, false
|
||||||
```
|
```
|
||||||
#### Short-circuit evaluation
|
#### Short-circuit evaluation
|
||||||
&& and || behave as a short-circuit operators.
|
&& and || behave as a short-circuit operators.
|
||||||
|
Reference in New Issue
Block a user