邏輯運算符號
發表於 : 2006-07-31 17:15:34
http://www.quirksmode.org/js/boolean.html
For JavaScript purposes, you need to know AND, OR and NOT:
* AND (&&): True when both elements are true.
Example: (x==4 && y==1).
* OR (||): True when at least one of the elements is true.
Example: (x==4 || y==1).
* NOT (!): This toggles a statement from true to false or from false to true.
Example: (x==4 || !(y==1)). This example is true if x is 4 OR y is NOT 1.
For JavaScript purposes, you need to know AND, OR and NOT:
* AND (&&): True when both elements are true.
Example: (x==4 && y==1).
* OR (||): True when at least one of the elements is true.
Example: (x==4 || y==1).
* NOT (!): This toggles a statement from true to false or from false to true.
Example: (x==4 || !(y==1)). This example is true if x is 4 OR y is NOT 1.