Microsoft® JScript JScript Operators |
JScript Tutorial Previous | Next |
JScript has a full range of operators, including arithmetic, logical, bitwise, and assignment operators. There are also a few miscellaneous operators.
Computational Logical Bitwise Assignment Miscellaneous Description Symbol Description Symbol Description Symbol Description Symbol Description Symbol Unary negation - Logical NOT ! Bitwise NOT ~ Assignment = delete delete Increment ++ Less than < Bitwise Left Shift << Compound Assignment OP= typeof typeof Decrement -- Greater than > Bitwise Right Shift >>     void void Multiplication * Less than or equal to <= Unsigned Right Shift >>>         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 ,                 Identity ===                 Nonidentity !==            
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 left to right order.
Operator Description . [] () Field access, array indexing, and function calls ++ -- - ~ ! typeof new void delete 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 to, greater than, greater than or equal to == != === !== Equality, inequality, identity, nonidentity & 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 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: (), *, +, +, =.
- Evaluation of the expression within the parentheses is first: There are two addition operators, and they have the same precedence: 96 and 3 are added together and 45 is added to that total, resulting in a value of 144.
- Multiplication is next: 78 and 144 are multiplied, resulting in a value of 10998.
- Assignment is last: 11232 is assigned into z.
© 1997 by Microsoft Corporation. All rights reserved.
file: /Techref/language/jscript/js617.htm, 12KB, , updated: 1997/9/30 02:44, local time: 2024/11/30 20:59,
3.140.186.189: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://sxlist.com/TECHREF/language/jscript/js617.htm"> JScript Operators</A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to sxlist.com! |
.