Common Javascript Operators (Operators)-Basic javascript tutorial

Source: Internet
Author: User

Basic javascript tutorial Arithmetic Operators

Operator Operator description Example Example
+ Addition X + y

If x is an integer of 2, y is an integer of 5, x + y is equal to 7

If x is the string "text1" and y is the string "fun ",

X + y equals to "text1fun"

- Subtraction X-y
* Multiplication X * y
/ Division X/y
% Division of the two X % y If x is equal to 10, y is equal to 3, and x % y is equal to 1
++ Increment X ++ If x equals 10, x ++ equals 11
-- Decrease Y -- If y equals 10, y -- equals 9

Basic javascript tutorial logical operators

Operator Operator description Example Example
= Equal X = y If x equals 2 and y equals 2, x = y
=== All equals (values are equal, and data types are equal) X = y

If x is equal to integer 2 and y is the string "2 ",

Then x = y is not true.

> Greater X> y
> = Greater than or equal X> = y
< Less X <y
<= Less than or equal X <= y
! = Not equal X! = Y
! = Not equal X! = Y
&& And) X <10 & y> 1
! Not) ! (X = y)
| Or (or) X = 8 | y = 8

Basic javascript tutorial assignment operator

Operator Operator description Example Example
= Assignment X = 5 Assign the value of integer 5 to variable x

Note:: Pay attention to the difference between value assignment (=) and equal to (=.

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.