A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript/bitwise-and-assignment-operator-in-javascript/ below:

Bitwise AND Assignment (&=) Operator in JavaScript

Bitwise AND Assignment (&=) Operator in JavaScript

Last Updated : 23 Jul, 2025

The Bitwise AND Assignment Operator is represented by "&=". This operator uses the binary representation of both operands and performs the bitwise AND operation and then assigns the result to the left operand. 

This can also be explained as applying the logical AND operation to the first operand and second operand and after that assigning the result to the first operand.

Syntax:

a &= b 
Or
a = a & b
 

Where -

Example 1: In this example, we will see the bitwise AND Assignment.

JavaScript
let x = 7;      // 00000000000000000000000000000111
x &= 3;         // 00000000000000000000000000000011

console.log(x); 

Output:

3

Example 2: In this example, we will see the logical AND operation between two operands.

JavaScript
let x = 7;
let y = 3;
x &= y;
console.log(x); 

x &= 0;
console.log(x); 

Output:

3
0

We have a complete list of Javascript Assignment Operators, to go through those please check the Javascript Assignment Operator article.

Supported Browser:



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4