JScript has a full range of operators, including arithmetic, logic, bit, value assignment, and some other operators

Source: Internet
Author: User
Tags bitwise operators
Arithmetic Operators  
Description symbol
Negative value-
Increment ++
Decrease-
Multiplication *
Division/
Modulo operation %
Addition +
Subtraction-

Arithmetic Operators

Description symbol
Negative value-
Increment ++
Decrease-
Multiplication *
Division/
Modulo operation %
Addition +
Subtraction- Logical operators  
Description symbol
Non-logical!
Less than <
Greater than>
Less than or equal to <=
Greater than or equal to> =
Equal to =
Not equal! =
Logic &&
Logic or |
Condition (ternary operator )? :
Comma,
Strictly equal =
Not strictly equal! =

Bitwise operators
Description symbol
Bitwise inversion ~
Shift left by bit <
Shift right by bit>
Unsigned shift to the right >>>
Bitwise AND &
By bit or ^
By bit or |

   Value assignment operator  
Description symbol
Assignment =
Assignment op = Arithmetic Operators
Description symbol
Negative value-
Increment ++
Decrease-
Multiplication *
Division/
Modulo operation %
Addition +
Subtraction- Logical operators  
Description symbol
Non-logical!
Less than <
Greater than>
Less than or equal to <=
Greater than or equal to> =
Equal to =
Not equal! =
Logic &&
Logic or |
Condition (ternary operator )? :
Comma,
Strictly equal =
Not strictly equal! = Bitwise operators  
Description symbol
Bitwise inversion ~
Shift left by bit <
Shift right by bit>
Unsigned shift to the right >>>
Bitwise AND &
By bit or ^
By bit or | Value assignment operator  
Description symbol
Assignment =
Assignment op = Miscellaneous Operators  
Description symbol
Delete Delete
Typeof operator typeof
Void void
Instanceof
New
In in

The difference between = (equal) and = (strictly equal) Is that constant operators forcibly convert different types of values before comparison. For example, the comparison result of the constant parameter on the string "1" and the value 1 is true. Strict equality does not force conversion of different types of values, so it considers that the string "1" is different from the value 1.

The basic strings, values, and boolean values are compared by value. If their values are the same, the comparison results are equal. Objects (including array, function, String, number, Boolean, error, date, and Regexp objects) are compared by reference. Even if the two variables of these types have the same value, the comparison result is true only when they are exactly the same object.

For example:

// Two basic strings with the same value.
VaR string1 = "hello ";
VaR string2 = "hello ";

// Two string objects with the same value.
VaR stringobject1 = new string (string1 );
VaR stringobject2 = new string (string2 );

// The comparison result is true.
If (string1 = string2)
// Execute some commands (to be run ).

// The comparison result is false.
If (stringobject1 = stringobject2)
// Execute some commands (not run ).

// Compare the value of the string object,
// Use the tostring () or valueof () method.
If (stringobject1.valueof () = stringobject2)
// Execute some commands (to be run ).

  
Description symbol
Delete Delete
Typeof operator typeof
Void void
Instanceof
New
In in

The difference between = (equal) and = (strictly equal) Is that constant operators forcibly convert different types of values before comparison. For example, the comparison result of the constant parameter on the string "1" and the value 1 is true. Strict equality does not force conversion of different types of values, so it considers that the string "1" is different from the value 1.

The basic strings, values, and boolean values are compared by value. If their values are the same, the comparison results are equal. Objects (including array, function, String, number, Boolean, error, date, and Regexp objects) are compared by reference. Even if the two variables of these types have the same value, the comparison result is true only when they are exactly the same object.

For example:

// Two basic strings with the same value.
VaR string1 = "hello ";
VaR string2 = "hello ";

// Two string objects with the same value.
VaR stringobject1 = new string (string1 );
VaR stringobject2 = new string (string2 );

// The comparison result is true.
If (string1 = string2)
// Execute some commands (to be run ).

// The comparison result is false.
If (stringobject1 = stringobject2)
// Execute some commands (not run ).

// Compare the value of the string object,
// Use the tostring () or valueof () method.
If (stringobject1.valueof () = stringobject2)
// Execute some commands (to be run ).

Description symbol
Non-logical!
Less than <
Greater than>
Less than or equal to <=
Greater than or equal to> =
Equal to =
Not equal! =
Logic &&
Logic or |
Condition (ternary operator )? :
Comma,
Strictly equal =
Not strictly equal! =

Bitwise operators
Description symbol
Bitwise inversion ~
Shift left by bit <
Shift right by bit>
Unsigned shift to the right >>>
Bitwise AND &
By bit or ^
By bit or |

Value assignment operator
Description symbol
Assignment =
Assignment op =

Miscellaneous Operators
Description symbol
Delete Delete
Typeof operator typeof
Void void
Instanceof
New
In in

The difference between = (equal) and = (strictly equal) Is that constant operators forcibly convert different types of values before comparison. For example, the comparison result of the constant parameter on the string "1" and the value 1 is true. Strict equality does not force conversion of different types of values, so it considers that the string "1" is different from the value 1.

The basic strings, values, and boolean values are compared by value. If their values are the same, the comparison results are equal. Objects (including array, function, String, number, Boolean, error, date, and Regexp objects) are compared by reference. Even if the two variables of these types have the same value, the comparison result is true only when they are exactly the same object.

For example:

// Two basic strings with the same value.
VaR string1 = "hello ";
VaR string2 = "hello ";

// Two string objects with the same value.
VaR stringobject1 = new string (string1 );
VaR stringobject2 = new string (string2 );

// The comparison result is true.
If (string1 = string2)
// Execute some commands (to be run ).

// The comparison result is false.
If (stringobject1 = stringobject2)
// Execute some commands (not run ).

// Compare the value of the string object,
// Use the tostring () or valueof () method.
If (stringobject1.valueof () = stringobject2)
// Execute some commands (to be run ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.