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.
orオペレーターがインターで何をするかわかりません。次のコードがあります
or
-1||4 // output -1 4||-1 //output 4
整数をバイト単位に変換し、または操作を実行しますか。
truthy最初に番号がorであるかどうかをチェックし、最初の番号falseyを返しますtruthy。を除いて、すべての数値は真です0。
truthy
falsey
0
0 || 4; // 4 2 || 3; // 2 (picks the first one, because both true) -3 || 0; // -3 0 || -2; // -2
整数をバイト単位に変換して実行または操作しますか?
いいえ、||演算子はlogical andではなくbitwise andです。
||
logical and
bitwise and