Javascript operators: Difference between revisions
From wikinotes
No edit summary |
|||
Line 18: | Line 18: | ||
<blockquote> | <blockquote> | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
x | y // bitwise or | x | y // bitwise or (set binary bit) | ||
x ^ y // bitwise exclusive and | x ^ y // bitwise exclusive and (unset binary bit) | ||
x & y // bitwise and | x & y // bitwise and (intersection of binary bits) | ||
x << n // bitwise shift by n bits | x << n // bitwise shift by n bits | ||
x >> n // bitwise shift by n bits | x >> n // bitwise shift by n bits |
Revision as of 14:19, 31 July 2021
and/or
&& || // condition AND/OR condition
equality greater/less than
== != // equals or not equals === !== // same object instance? < > <= >= // greater-than less-than
bitwise operators
x | y // bitwise or (set binary bit) x ^ y // bitwise exclusive and (unset binary bit) x & y // bitwise and (intersection of binary bits) x << n // bitwise shift by n bits x >> n // bitwise shift by n bits ~x // invert bits