From 7bd476c232a845ce418b1fadcd3de5bb06654d8b Mon Sep 17 00:00:00 2001 From: Debalina Date: Sat, 16 Feb 2019 09:02:27 -0800 Subject: [PATCH] add code snippet: logical operator (#29842) add code snippet for logical operator short-circuit evaluation --- guide/english/javascript/logical-operators/index.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/guide/english/javascript/logical-operators/index.md b/guide/english/javascript/logical-operators/index.md index a393bc7c35..7c1fdfe0e6 100644 --- a/guide/english/javascript/logical-operators/index.md +++ b/guide/english/javascript/logical-operators/index.md @@ -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.