Changes

Jump to: navigation, search

JavaScript Operators

1 byte removed, 13:31, 5 June 2007
Logical Operators
''If x is less than 10 AND y is greater than 20 display a message.''
Here the logical operator is the "AND" part of the sentence. If we were to express this in JavaScript we would use the comparision comparison operators we covered earlier together with the && logical operator:
<pre>
''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 equivalent ||:
<pre>
(10 > 1) // returns ''true''
!(10 > 1) // retruns returns ''false'' because we have inverted the result with the logical NOT
</pre>
5
edits

Navigation menu