[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Operators/Logical_AND_assignment [Back]  [Original]

(&&=) - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

(&&=)

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2020 ..

(x &&= y) x , .

In this article

let a = 1;
let b = 0;

a &&= 2;
console.log(a);
// Expected output: 2

b &&= 2;
console.log(b);
// Expected output: 0

js
expr1 &&= expr2;

, , :

( ) && ;

, , .. , , (, , ).

, x &&= y , :

js
x && (x = y);

, :

js
x = x && y;

js
let x = 0;
let y = 1;

x &&= 0; // 0
x &&= 1; // 0
y &&= 1; // 1
y &&= 0; // 0

Specification
ECMAScript 2027 LanguageSpecification
# sec-assignment-operators


Web Proxy Viewer  |  New URL  |  Original Page