Changes

Jump to: navigation, search

JavaScript Operators

446 bytes added, 18:39, 20 April 2007
Logical Operators
''If x is less than 10 OR y is greater than 20 display a message.''
 
Then we would replace the "OR" with the JavaScript equavalent ||:
 
<pre>
 
if ((x < 10) || (y > 20)
document.write ("Message");
 
</pre>
 
The final Logical Operator is the NOT operator which simply inverts the result of an expression. The ! character represents the NOT operatoer and can be used as follows:
 
<pre>
 
(10 > 1) // returns ''true''
 
!(10 > 1) // retruns ''false'' because we have inverted the result with the logical NOT
== Operator Precedence ==

Navigation menu