JavaScript Operators - Logical Captain?
(Page 6 of 6 )
Spock was a walking computer. You could ask him the chances of anything and he would know.
*Impersonating Kirk*: What are the chances of that guy..in...the red shirt getting........shot?
Spock: 100%
*Impersonating Kirk*: What are the chances of a computer nerd having a date this weekend...not involving...other nerds?
Spock: -100%
That was a good episode. And by the way, J.J. Abrahms if you are reading this, I am totally available to write the next Star Trek script or even an episode or 400 of Lost.
There are three logical operators in JavaScript. They are the && (AND), the || (OR) and the ! (NOT). There is technically a fourth, the ?: (Ternary) but we won't be focusing on that one.
Again, logical operators are mostly used for statements. The && operator says that this and that must meet the criteria, while the || states that either this or that must meet the criteria. And finally the ! operator says that the criteria is not equal to this or that.
While there are more operators in JavaScript, these are the most common.
Well slackers, that is it for this lesson in JavaScript. Join us next time as we discuss Pop-Up Boxes, Functions, and maybe even Loops.
Till then....
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |