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

Bitwise AND (&) - 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

Bitwise AND (&)

Baseline Widely available

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

(&) 1 , 1.

In this article

const a = 5; // 00000000000000000000000000000101
const b = 3; // 00000000000000000000000000000011

console.log(a & b); // 00000000000000000000000000000001
// Expected output: 1

a & b

32- ( and ). 32 . , 32 32- :

: 11100110111110100000000000000110000000000001
:          10100000000000000110000000000001

: - ,- , ..

, .

:

a b a b
0 0 0
0 1 0
1 0 0
1 1 1
js
.    9 (base 10) = 00000000000000000000000000001001 (base 2)
    14 (base 10) = 00000000000000000000000000001110 (base 2)
                   --------------------------------
14 & 9 (base 10) = 00000000000000000000000000001000 (base 2) = 8 (base 10)

x 0 0.

js
// 5: 00000000000000000000000000000101
// 2: 00000000000000000000000000000010
5 & 2; // 0

Specification
ECMAScript 2027 LanguageSpecification
# prod-BitwiseANDExpression


Web Proxy Viewer  |  New URL  |  Original Page