Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
var a = 0; var c = 3; function myFunction(b) { a = a | b; return (a == c); }
今天看到这个,“a = a | b”是做什么的?
您正在执行bitwise-or操作并将结果分配给 a。
bitwise-or
例子:
如果 a=5 和 b=4 则其二进制表示的相应位由 a 操作or-operation。
or-operation
a=101 b=100 a=a|b=101|101=101=5;