| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Operators/Logical_AND | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 ..
(&&) () Boolean true , true. false.
const a = 3;
const b = -2;
console.log(a > 0 && b > 0);
// Expected output: false
expr1 && expr2;
true, (truthy). false, (falsy).
, false:
false;null;NaN;0;"", '', ``);undefined.:
result = "" && "foo"; // result is assigned "" (empty string)
result = 2 && 0; // result is assigned 0
result = "foo" && 4; // result is assigned 4
, && , , , .
( ) , Boolean.
.
, false, . .
.
( ) &&
( ) , .
, .
:
function A() {
console.log(" A");
return false;
}
function B() {
console.log(" B");
return true;
}
console.log(A() && B());
// A, " A",
// && false ( A false), false;
// B
false || (true && true); // true
true && (false || false); // false
2 == 3 || (4 < 0 && 1 == 1); // false
&& ( ).
a1 = true && true; // t && t true
a2 = true && false; // t && f false
a3 = false && true; // f && t false
a4 = false && 3 == 4; // f && f false
a5 = "Cat" && "Dog"; // t && t "Dog"
a6 = false && "Cat"; // f && t false
a7 = "Cat" && false; // t && f false
a8 = "" && false; // f && f ""
a9 = false && ""; // f && f false
:
bCondition1 && bCondition2;
:
!(!bCondition1 || !bCondition2);
:
bCondition1 || bCondition2;
:
!(!bCondition1 && !bCondition2);
, .
:
bCondition1 || (bCondition2 && bCondition3);
, :
bCondition1 || (bCondition2 && bCondition3);
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # prod-LogicalANDExpression |
This page was last modified on 29 . 2026 . by MDN contributors.
Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |