Javascript operators: Difference between revisions

From wikinotes
 
Line 9: Line 9:
<blockquote>
<blockquote>
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
== !=      // equals or not equals
== !=      // equality        ( '1' == 1 )
=== !==    // same object instance?
=== !==    // strict equality ( '1' !=== 1 )
< > <= >=  // greater-than less-than
< > <= >=  // greater-than less-than
</syntaxhighlight>
</syntaxhighlight>
* equality:        https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality
* strict-equality: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_equality
</blockquote><!-- equality greater/less than -->
</blockquote><!-- equality greater/less than -->



Latest revision as of 21:48, 27 August 2021

and/or

&& ||      // condition AND/OR condition

equality greater/less than

== !=      // equality        ( '1' == 1 )
=== !==    // strict equality ( '1' !=== 1 )
< > <= >=  // 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