JavaScript Basics-Operators and expressions

Source: Internet
Author: User

One, operator

1. Operator Classification:

by function: arithmetic operator: + 、-、 *,/,%, + + 、--

Example: 12+12-11+5*6+20/5+5%2+ (5%-2) + ( -5++2) + (a++) + (++a) + (--a) + (a--). Note that the return result value in the modulo operator is independent of the second argument and the positive and negative correlation of the first parameter.

Assignment operator: =

String operators: +, concatenation operators

Logical operator:&& (one non-wholly non), | | (A true whole is true)

Relational operators:>, >=, <, <=, = =,! =, = = =,!==

Bitwise operators:

Other operators: conditional operator Condition?value1:value2.

Comma operator, true:value1,value2,

Delete Operator: delete operator to remove a variable that is not defined with Var. The delete operator can delete an object's properties, delete an object that is not defined with VAR, delete an array element after the operation has a constant length, and a value of undefined;

In operator: Determines whether an attribute belongs to an object or an array of element attributes, and returns a Boolean type

Instanceof Operator: Determines whether an instance object belongs to an object type, returns a Boolean type

New operator: Creates a JavaScript-custom or built-in object.

This operator: Represents an Entity object, etc.

typeof operator: Returns the type information of the object to be viewed as a string

void operator: An operator that does not return any information.

. Operator: object property access operation

[] Operator: reads or sets element properties.

By number: unary operator: + (positive),-(negative)

Binary operators: + 、-、 *, =,%, etc.

Ternary operator:? :

2, operand type: JS weak type, general calculation rules from left to right, the operation of the two-dollar operator when the previous operand type is a base type operation.

  

JavaScript Basics-Operators and expressions

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.