|
Expressions and operators in JavaScript follow closely their cousins in C/C++ or Java. Users familiar with these languages should feel right at home. Expressions are combinations of variables and operators to produce a resulting value. Expressions can be used as the right hand side of an assignment, as function arguments, and in return statements. Expressions are the heart of JavaScript. Embedded JavaScript implements a subset of the ECMAScript specification for expressions and operators. The following operators are not supported: ===, !==, >>>, prefix ++ and --, &, |, ^, ?:. The operator / assignment combinations such as *= are also not supported.
The following table summarises the operators available in Embedded JavaScript. For a complete specification, please consult the ECMA-262 specification. |
| Operator |
Operands |
Description |
| * / % |
Numbers |
Multiply, divide, modulo |
| + |
Numbers, Strings |
Add numbers, catenate strings |
| - |
Numbers |
Subtract numbers |
| ! |
Boolean |
Unary not |
| ++ |
Numbers |
Post-increment number |
| -- |
Numbers |
Post-decrement number |
| << |
Integers |
Left shift |
| >> |
Integers |
Right shift |
| == != |
All |
Compare if equal, not equal |
| < <= |
Numbers, Strings |
Compare if less than, less than or equal |
| > >= |
Numbers, Strings | Compare if greater than, greater than or equal |
| && |
Booleans |
Logical AND |
| || |
Booleans |
Logical OR |
| . |
object.property |
Property access |
| [] |
array[integer] array[string] |
Array element access |
| () |
function(any, ...) |
Function call |
| new |
constructor function |
Create a new object using the given constructor |
| delete |
delete object.property |
Undefine a property |
Operator Precedencea = x + y * z;
a = x + (y * z);
| Operator |
| . [] () new |
| ++ -- - + delete |
| * / % |
| + - |
| << >> |
| < <= > >= |
| == != |
| && |
| || |
| = |
| , |
Operatorsdelete customer.currentOrder;