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

(|) - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

(|)

Baseline

20157

(|) 1 1

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

console.log(a | b); // 00000000000000000000000000000111
// : 7

js
x | y

| 2 32 OR 32 OR TypeError

2 2 1 2

OR

a b a OR b
0 0 0
0 1 1
1 0 1
1 1 1
     9 (10 ) = 00000000000000000000000000001001 (2 )
    14 (10 ) = 00000000000000000000000000001110 (2 )
                   --------------------------------
14 | 9 (10 ) = 00000000000000000000000000001111 (2 ) = 15 (10 )

32 32 32

: 11100110111110100000000000000110000000000001
:             10100000000000000110000000000001

: | 0 x 0 OR x 32 -2147483648 2147483647 Math.trunc()

0 1

js
// 9  (00000000000000000000000000001001)
// 14 (00000000000000000000000000001110)

14 | 9;
// 15 (00000000000000000000000000001111)

14n | 9n; // 15n

ECMAScript 2027 LanguageSpecification
# prod-BitwiseORExpression


Web Proxy Viewer  |  New URL  |  Original Page