JScript includes a number of different operators that you can use to perform calculations, make comparisons, make assignments, and more. This section presents the most commonly used JScript operators, organized by type: Table B-1 lists the mathematical operators; Table B-2 lists the comparison operators; and Table B-3 lists the assignment operators.
Operator | Description | Example Usage |
---|---|---|
* | Multiplication | OrderTotal * 1.1; |
/ | Division | TotalItems / 2; |
% | Modulus arithmetic | Quantity % 2; |
+ | Addition | OrderTotal + TaxTotal; |
– | Subtraction | OrderTotal – Discount; |
++ | Increment | ++k // to increment a counter |
-- | Decrement | --k // to decrement a counter |
Operator | Description |
---|---|
< | Less than |
> | Greater than |
<= | Less than or equal to |
>= | Greater than or equal to |
== | Equality |
!= | Inequality |
Operator | Description | Example Usage |
---|---|---|
= | Assignment | SalesTaxRate = .06; |