Basic JavaScript Learning

Source: Internet
Author: User

First, JS Basic classification

1. Constants

1.1 Integer constants: Binary Conversions (number.tostring (16)--parentheses are converted into several binary);

1.2 Real-type constants

1.3 Boolean value: True and false, lowercase;

1.4-Character constants: single and double quotes;

1.5 null: null--The value of the non-existent quantity returns null;

1.6 Special characters: non-realistic special characters with/start for control characters;

Second, the variable: mainly used as access data, to provide information storage container, divided into global variables and local variables.

2.1 Attention Points

2.11 variable name valid, must start with a caption, the middle can have numbers and underscores (_), no space +-comma or other symbols;

2.12 cannot use the keyword in JS as the variable name;

2.13 variables must be declared before using Var;

Third, operator

3.1 Arithmetic operators: Add, subtract, multiply, divide, take surplus (%), take counter-, take complement ~,++ sliding scale,--decrement;

3.2 comparison operator (result true or false):>, <, >=, <=, = =,! =;

3.3 Logical operators:! Take anti-,&& with, | | Or

3.4 String arithmetic;

Iv. Expressions: A collection of operators

V. BASIC statements

5.1 If-else Conditional statement

The format is: if (expression) {

Execute statement 1;

}else{

EXECUTE statement 2;

}

5.2 For Loop statement

Format: for (start condition; termination condition; variable change) {

Execute the statement;

}

5.3 Break statement: Jump out of a for or while

5.4 Continue statement: End the current loop and go to the next loop

5.5 Switch statement:

Format: switch (expression) {

Case value 1;

Statement 1;

Break

Case value 2;

Statement 2;

Break

。。。

Default

Statement N;

}

Vi. functions

JavaScript Basic Learning

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.