Javascript&jquery. Expressions and operators

Source: Internet
Author: User
Tags arithmetic arithmetic operators logical operators

Expressions and operators

An expression

An expression can ask for a value, and the evaluation can contain an operation.

varlength=80

Two or more values can be used in an expression, and the expression eventually returns a value. If you ask for the area of the table.

var area=80*60

Operator

An operator is required in the expression, which operates on one or more values and gets a value.

Commonly used operators are: assignment operators, comparison operators, arithmetic operators, logical operators, string operators.

Arithmetic operators

Arithmetic operators are similar to mathematics, and are used very much in numerical calculations.

Add + adds a value and another value

Subtraction-Subtracts one value from another

Divide/Divide two values

Multiply * multiply two values by using an asterisk (*)

Increment + + Current value plus one

Decrement--current value minus one

Modulo% two values divide, return remainder

String operator

There is only one string operator (+) that is used to concatenate strings sequentially.

var strA= "Hello" ; var strB= "JavaScript" ; var strC=strA+strB; document.write(strC);strings can not only concatenate strings, they can also concatenate numbers, and numbers are used when strings are concatenated. var strA= "Hello " ; var strB=368; var strC=strA+strB; document.write(strC);

Javascript&jquery. Expressions and operators

Related Article

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.