The document is archived and information here might be outdated

Operators (Visual Studio - JScript)

JScript includes a number of operators that fall into the arithmetic, logical, bitwise, assignment, and miscellaneous categories. The following sections link to information that explains how to use the operators.

Addition Assignment Operator (+=) Adds two numbers or concatenates two strings, and assigns the result to the first argument.

Addition Operator (+) Adds two numbers or concatenates two strings.

Assignment Operator (=) Assigns a value to a variable.

Bitwise AND Assignment Operator (&=) Performs a bitwise AND on two expressions, and assigns the result to the first argument.

Bitwise AND Operator (&) Performs a bitwise AND on two expressions.

Bitwise Left Shift Operator (<<) Shifts the bits of an expression to the left.

Bitwise NOT Operator (~) Performs a bitwise NOT (negation) on an expression.

Bitwise OR Assignment Operator (|=) Performs a bitwise OR on two expressions, and assigns the result to the first argument.

Bitwise OR Operator (|) Performs a bitwise OR on two expressions.

Bitwise Right Shift Operator (>>) Shifts the bits of an expression to the right, maintaining sign.

Bitwise XOR Assignment Operator (^=) Performs a bitwise exclusive OR on two expressions, and assigns the result to the first argument.

Bitwise XOR Operator (^) Performs a bitwise exclusive OR on two expressions.

Comma Operator (,) Causes two expressions to be executed sequentially.

Comparison Operators An assortment of operators (==, >, >=, ===, !=, <, <=, !==) that return a Boolean value indicating the result of a comparison

Conditional (Ternary) Operator (?:) Chooses one of two statements to run depending on a condition.

delete Operator Deletes a property from an object, or removes an element from an array.

Division Assignment Operator (/=) Divides two numbers, returns a numeric result, and assigns the result to the first argument.

Division Operator (/) Divides two numbers and returns a numeric result.

in Operator Tests for the existence of a property in an object.

Increment (++) and Decrement (--) Operators Increment operator (++) increments a variable by one; decrement operator (--) decrements a variable by one.

instanceof Operator Returns a Boolean value that indicates whether or not an object is an instance of a particular class.

Left Shift Assignment Operator (<<=) Shifts the bits of an expression to the left, and assigns the result to the first argument.

Logical AND Operator (&&) Performs a logical conjunction on two expressions.

Logical NOT Operator (!) Performs logical negation on an expression.

Logical OR Operator (||) Performs a logical disjunction on two expressions.

Modulus Assignment Operator (%=) Divides two numbers and assigns the remainder to the first argument.

Modulus Operator (%) Divides two numbers and returns the remainder.

Multiplication Assignment Operator (*=) Multiplies two numbers and assigns the result to the first argument.

Multiplication Operator (*) Multiplies two numbers.

new Operator Creates a new object.

Reference Operator (&) Allows passing references to variables to methods with reference or out parameters.

Right Shift Assignment Operator (>>=) Shifts the bits of an expression to the right, maintaining sign, and assigns the result to the first argument.

Subtraction Assignment Operator (-=) Subtracts one number from another and assigns the result to the first argument.

Subtraction Operator (-) Indicates the negative value of a numeric expression or subtracts one number from another.

typeof Operator Returns a string that identifies the data type of an expression.

Unsigned Right Shift Assignment Operator (>>>=) Performs an unsigned right shift of the bits in an expression and assigns the result to the first argument.

Unsigned Right Shift Operator (>>>) Performs an unsigned right shift of the bits in an expression.

void Operator Prevents an expression from returning a value.

JScript Reference Lists elements that comprise JScript Language Reference and links to topics that explain the details behind the proper use of language elements.

JScript Operators Provides a conceptual overview of operators used in JScript and links to topics that explain the proper syntax for each operator and the significance of operator precedence.

Operator Precedence Provides a list containing information about the execution precedence of JScript operators.

Operator Summary Lists JScript operators and links to topics that explain their proper use.