# A.1 ECMAScript Operators

The following tables provide descriptions of the operators supported by the ECMA Expression Builder.

Table A-1 Math

Operator

Description

Returns the sum of two numerical values (either literals or variables).

- Subtract

Subtracts one number from another.

* Multiply

Returns the product of two numerical values (either literals or variables).

/ Divide

Divides one number by another.

Table A-2 Assignment

Operator

Description

= Assignment

Assigns the value of the right operand to the left operand.

Adds the left and right operands and assigns the result to the left operand. For example, a += b is the same as a = a + b.

-= Subtract from this

Subtracts the right operand from the left operand and assigns the result to the left operand. For example, a -= b is the same as a = a - b.

*= Multiply to this

Multiplies the two operands and assigns the result to the left operand. For example, a *= b is the same as a = a * b.

/= Divide this to

Divides the left operand by the right operand and assigns the result to the left operand. For example, a /= b is the same as a = a / b.

%= Modulus

Divides the left operand by the right operand and assigns the remainder to the left operand. For example, a %= b is the same as a = a % b.

&= Apply bitwise AND to this

Performs bitwise AND on operands and assigns the result to the left operand. For example, a &= b is the same as a = a & b.

|= Apply bitwise OR to this

Performs bitwise OR on operands and assigns the result to the left operand. For example, a |= b is the same as a = a | b.

<<= Apply bitwise left shift to this

Performs bitwise left shift on operands and assigns the result to the left operand. For example, a <<= b is the same as a = a << b.

>>= Apply bitwise signed right shift to this

Performs bitwise right shift on operands and assigns the result to the left operand. For example, a >>= b is the same as a = a >> b.

>>>= Apply bitwise unsigned right shift to this

Performs bitwise unsigned right shift on operands and assigns the result to the left operand. For example, a >>>= b is the same as a = a> >> b.

Table A-3 Other

Operator

Description

% Modulus

Divides the left operand by the right operand and returns the integer remainder.

++ Autoincrement

Increments the operand by one (can be used before or after the operand).

-- Autodecrement

Decrements the operand by one (can be used before or after the operand).

~ Bitwise NOT

Inverts the bits of its operand.

& Bitwise AND

Returns a 1 in each bit position for which the corresponding bits of both operands are ones.

| Bitwise OR

Returns a 1 in each bit position for which the corresponding bits of either or both operands are ones.

^ Bitwise XOR

Returns a 1 in each bit position for which the corresponding bits of either but not both operands are ones.

<< Bitwise left shift

Shifts the digits of the binary representation of the first operand to the left by the number of places specified by the second operand. The spaces created to the right are filled in by zeros, and any digits shifted to the left are discarded.

>> Signed bitwise right shift

Shifts the digits of the binary representation of the first operand to the right by the number of places specified by the second operand, discarding any digits shifted to the right. The copies of the leftmost bit are added on from the left, preserving the sign of the number.

>>> Unsigned bitwise right shift

Shifts the binary representation of the first operand to the right by the number of places specified by the second operand. Bits shifted to the right are discarded and zeroes are added to the left.

Table A-4 Relational

Operator

Description

== Equal

Assigns the value of the right operand to the left operand.

!= Not Equal

Returns a Boolean True if the operands are not equal.

< Less than

Returns True if the left operand is less than the right operand.

> Greater than

Returns True if the left operand is greater than the right operand.

<= Less than or equal

Returns True if the left operand is less than or equal to the right operand.

>= Greater than or equal

Returns True if the left operand is greater than or equal to the right operand.

Table A-5 Logical

Operator

Description

&& AND

Returns a Boolean true if both operands are true; otherwise, returns False.

|| OR

Returns True if either operand is true. Returns false when both operands are False.

! NOT

Returns False if its single operand can be converted to true (or if it is a non-Boolean value). Returns True if its operand can be converted to False.

Table A-6 String

Operator

Description

+ Concatenate

Concatenates two string operands, returning a string that is the union of the two operand strings.