1const a = 5; // 00000000000000000000000000000101
2const b = 3; // 00000000000000000000000000000011
3// xor operator ^
4console.log(a ^ b); // 00000000000000000000000000000110
5// expected output: 6
1var myEnum = {
2 left: 1,
3 right: 2,
4 top: 4,
5 bottom: 8
6}
7
8var myConfig = myEnum.left | myEnum.right;
9
10if (myConfig & myEnum.right) {
11 // right flag is set
12}
1let x1 = true || false && false;
2let x2 = (true || false) && false;
3let x3 = !false && false;
4let x4 = !(false && false);