Operators in JavaScript

Source: Internet
Author: User

In JavaScript, JavaScript is a full range of operators, including arithmetic, logic, bits, assignments, and some other operators.

Calculating the assignment of logical bit operations Miscellaneous

Description Symbol Description Symbol Description Symbol description Symbol description symbol

Negative value-logical non! bitwise Inverse ~ Assignment = delete deletewww.mlybyby.com

Increment + + less than < bitwise left SHIFT << operation assignment op=typeof operator typeof

Decrement--Greater than > bitwise RIGHT SHIFT >>voidvoid

Multiplication * is less than or equal to <= unsigned right shift >>>instanceofinstanceof

Division/greater than or equal >= bitwise AND &NEWNEW

Modulo operation% equals = = Bitwise XOR or ^inin

Add + not equals! = Bitwise OR |

Subtraction-Logic and &&

Logical OR | |

condition (ternary operator)?:

Comma

strictly equal = = =

Non-Strictly equal!==

The difference between = = (equality) and = = = (strictly equal) is that the identity operator casts different types of values before comparison. For example, the identity pair string "1" and the value 1 will result in a comparison of true. Strict equality does not cast values of different types, so it considers the string "1" to be not the same as the value 1.

The basic string, numeric, 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 result is true only if they are exactly the same object.

Two basic strings with the same value.

var string1 = "Hello";

var string2 = "Hello";

A two String object with the same value.

var StringObject1 = new String (string1); www.mlyrx120.com

var StringObject2 = new String (string2);

The comparison result is true.

if (string1 = = string2)

Executes some commands (which will run).

The comparison result is false.

if (StringObject1 = = StringObject2)

Execute some commands (not run).

To compare the value of a String object,

Use the toString () or ValueOf () method.

if (stringobject1.valueof () = = StringObject2)

Executes some commands (which will run).

Operators in JavaScript

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.