Microsoft® JScript Operator Summary |
| Tutorial | |
JScript has a full range of operators, including arithmetic, logical, bitwise, and assignment operators.
Computational Logical Bitwise Assignment Description Symbol Description Symbol Description Symbol Description Symbol Unary negation - Logical NOT ! Bitwise NOT ~ Assignment = Increment ++ Less than < Bitwise Shift Left << Compound Assignment OP= Decrement -- Greater than > Bitwise Shift Right >>     Multiplication * Less than or equal to <= Unsigned Shift Right >>>     Division / Greater than or equal to >= Bitwise AND &     Modulo arithmetic % Equality == Bitwise XOR ^     Addition + Inequality != Bitwise OR |     Subtraction - Logical AND &&             Logical OR ||             Conditional (trinary) ?:             Comma ,        
Operators in JScript are evaluated in a particular order. This order is known as the operator precedence. The following table lists the operators in highest to lowest precedence order. Operators in the same row are evaluated in a left to right fashion.
Operator Description . [] () field access, array indexing, and function calls ++ -- - ~ ! typeof new void unary operators, return data type, object creation, undefined values * / % multiplication, division, modulo division + - + addition, subtraction, string concatenation << >> >>> bit shifting < <= > >= less than, less than or equal, greater than, greater than or equal == != equality, inequality & bitwise AND ^ bitwise XOR | bitwise OR && logical AND || logical OR ?: conditional = OP= assignment, assignment with operation , multiple evaluation Parentheses are used to alter the order of evaluation. The expression within the parentheses is fully evaluated before its value is used in the remainder of the statement.
An operator with higher precedence is evaluated before one with lower precedence. For example:z = 78 * (96 + 3 + 45)There are five operators in this expression: =, *, (), +, and +. According to precedence, they are evaluated in the following order: (), *, +, +, =. So, the sequence of evaluation goes as follows:
- Evaluate the expression within the ().
- There are two operators here, but they have the same precedence. So 96 and 3 are added and 45 added to that total, resulting in a value of 144.
- Multiplication is next, so 78 and 144 are multiplied, resulting in a value of 10998.
- Assignment is last, so 11232 is assigned into z.
file: /Techref/language/asp/js/308.htm, 10KB, , updated: 1996/11/22 10:12, local time: 2024/12/18 22:44,
3.148.112.29:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://massmind.org/techref/language/asp/js/308.htm"> Operators - Microsoft® JScript</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to massmind.org! |
.