| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Operators/Left_shift | [Back] [Original] |
Get to know MDN better
const a = 5; // 00000000000000000000000000000101
const b = 2; // 00000000000000000000000000000010
console.log(a << b); // 00000000000000000000000000010100
// : 20
x << y
2 9 << 2 36
9 (10 ): 00000000000000000000000000001001 (2 )
--------------------------------
9 << 2 (10 ): 00000000000000000000000000100100 (2 ) = 36 (10 )
x y x * 2 ** y
9 << 3 9 * (2 ** 3) = 9 * (8) = 72
32 32 32
Before: 11100110111110100000000000000110000000000001 After: 10100000000000000110000000000001
32 32 0 31 100 << 32 100 << 0 (100) 32 32 0
:
<< 0 x 0 x 32 -2147483648 2147483647 Math.trunc()
0 1
9 << 3; // 72
// 9 * (2 ** 3) = 9 * (8) = 72
9n << 3n; // 72n
| ECMAScript 2027 LanguageSpecification # sec-left-shift-operator |
| Web Proxy Viewer | New URL | Original Page |