Skip to content

Latest commit

 

History

History
28 lines (22 loc) · 267 Bytes

File metadata and controls

28 lines (22 loc) · 267 Bytes

位元操作 (Bit Manipulation)

二進位制

0001 -> 1
0010 -> 2
0011 -> 3
0100 -> 4
0101 -> 5
0110 -> 6
0111 -> 7
1000 -> 8

左移:

const x = 1; // 0001
x << 2; // 0100 -> 4

右移:

const x = 4; // 0100
x >> 2; // 0001 -> 1