add code snippet: logical operator (#29842)

add code snippet for logical operator short-circuit evaluation
pull/29854/head^2
Debalina 2019-02-16 09:02:27 -08:00 committed by Christopher McCormack
parent db63a354ee
commit 7bd476c232
1 changed files with 5 additions and 0 deletions

View File

@ -43,6 +43,11 @@ In case of the logical AND, if the first operand returns false, the second opera
In case of the logical OR, if the first value returns true, the second value is never evaluated and the first operand is returned.
```js
false && (anything) // short-circuit evaluated to false.
true || (anything) // short-circuit evaluated to true.
```
#### Logical NOT (!)
The NOT operator does not do any comparison like the AND and OR operators.Moreover it is operated only on 1 operand.