JavaScript uses comparison operators inside conditions to make numeric or alphabetical comparisons of variables to other variables or values. Using these operators, you can determine whether a variable is greater than, less than, or equal to another variable or value. You can also use combinations of these comparison operators.
Name | Operator | Example | Notes |
---|---|---|---|
Equality | == | (x==3) | Works with all variable types, including strings. |
Not equal | != | (x != 3) | True if values are not equal. |
Less than | < | (x < 3) | Numeric or alphabetical comparison. |
Greater than | > | (x > 3) | Numeric or alphabetical comparison. |
Less than or equal to | <= | (x <= 3) | Numeric or alphabetical comparison. |
Greater than or equal to | >= | (x >= 3) | Numeric or alphabetical comparison. |
dummies
Source:http://www.dummies.com/how-to/content/add-javascript-comparison-operators-to-condition-s.html
No comments:
Post a Comment