From 01b0e12ba27b5069248fd09235e9a7143915ee30 Mon Sep 17 00:00:00 2001 From: Irvin Date: Wed, 16 Feb 2022 02:02:49 +0800 Subject: remove `notranslate` class in zh-CN --- .../reference/operators/logical_or/index.html | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'files/zh-cn/web/javascript/reference/operators/logical_or') diff --git a/files/zh-cn/web/javascript/reference/operators/logical_or/index.html b/files/zh-cn/web/javascript/reference/operators/logical_or/index.html index 1a8f881377..3604b99140 100644 --- a/files/zh-cn/web/javascript/reference/operators/logical_or/index.html +++ b/files/zh-cn/web/javascript/reference/operators/logical_or/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Operators/Logical_OR

语法

-
expr1 || expr2
+
expr1 || expr2
 

Description

@@ -42,7 +42,7 @@ translation_of: Web/JavaScript/Reference/Operators/Logical_OR

Short circuit means that the expr part above is not evaluated, hence any side effects of doing so do not take effect (e.g., if expr is a function call, the calling never takes place). This happens because the value of the operator is already determined after the evaluation of the first operand. See example:

-
function A(){ console.log('called A'); return false; }
+
function A(){ console.log('called A'); return false; }
 function B(){ console.log('called B'); return true; }
 
 console.log( B() || A() );
@@ -54,7 +54,7 @@ console.log( B() || A() );
 
 

The following expressions might seem equivalent, but they are not, because the && operator is executed before the || operator (see operator precedence).

-
true || false && false      // returns true, because && is executed first
+
true || false && false      // returns true, because && is executed first
 (true || false) && false    // returns false, because operator precedence cannot apply

Examples

@@ -63,7 +63,7 @@ console.log( B() || A() );

The following code shows examples of the || (logical OR) operator.

-
o1 = true  || true       // t || t returns true
+
o1 = true  || true       // t || t returns true
 o2 = false || true       // f || t returns true
 o3 = true  || false      // t || f returns true
 o4 = false || (3 == 4)   // f || f returns false
@@ -85,21 +85,21 @@ o10 = false || varObject // f || object returns varObject
 
 

The following operation involving booleans:

-
bCondition1 && bCondition2
+
bCondition1 && bCondition2

is always equal to:

-
!(!bCondition1 || !bCondition2)
+
!(!bCondition1 || !bCondition2)

Converting OR to AND

The following operation involving booleans:

-
bCondition1 || bCondition2
+
bCondition1 || bCondition2

is always equal to:

-
!(!bCondition1 && !bCondition2)
+
!(!bCondition1 && !bCondition2)

Removing nested parentheses

@@ -107,11 +107,11 @@ o10 = false || varObject // f || object returns varObject

The following composite operation involving booleans:

-
bCondition1 && (bCondition2 || bCondition3)
+
bCondition1 && (bCondition2 || bCondition3)

is always equal to:

-
!(!bCondition1 || !bCondition2 && !bCondition3)
+
!(!bCondition1 || !bCondition2 && !bCondition3)

Specifications

-- cgit v1.2.3-54-g00ecf