JavaScript Basics (ii)

Source: Internet
Author: User

1. Various operators

(1) Arithmetic operators

+-*/% ()

(2) Self-increment decrement operator

a++ ++a A----a

If it is added first, a plus after operation will be given

If it is a post-add, it will be given a plus after the first operation.

(3) Logical operators

&& | | Or! Non -

(4) Relational operators (comparison operators)

> <, >=, <=, = =, = =,! =,!=== (not congruent)

= = Judge content, do not care about type

= = = Care about both content and type of care

(5) Assignment operator

= right-to-left view

(6) Comma operator

2. Conversion of data types

(1) Forced type conversion

By using Number:number (), parseint (), parsefloat ()

String:. ToString (), String ()

Boolean:boolean ()

To convert the data to the data type of the object

(2) Implicit conversion

Number:+a; A-B; a*b,a/1,a%1 (Note: A is a string type and B is number)

String:a+ "";

boolean:!! A

All the data in JavaScript can be turned into a Boolean,

Only False,0,nan, "", undefined will turn to False when the Boolean conversion is performed,

The rest is true, including "false"

3. Process Control

(1) if

If-else

If-elseif-else

(2) switch-case-(default):

To judge a series of conditions

JavaScript Basics (ii)

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.