JS's Beginner theory

Source: Internet
Author: User

JS's Beginner theory
I. Basic features of javascript:
explanatory scripting language;
The program does not need to compile;
The runtime is translated into machine language.
Two. Command-type programming:
Command "machine" How to do things, so whatever you want, it will follow your command. For example, common imperative programming languages are: Java, C, C + +, JavaScript, PHP, and so on.
Three. Declarative programming:
Tell the machine what you want, and let the machine figure out how to do it. For example, common declarative languages are: CSS, SQL.
1.JavaScript syntax
Note:/Here is a single-line comment;
/* Here is also a single comment */;
/*
Here is
Multi-line comments
*/;
2. Keywords
JS takes some identifiers and uses them as their own keywords. Therefore, it is no longer possible to use these keywords as identifiers in the program.
Break Delete function Return typeof case does if switch var catch else in this void continue flase instanceof throw while de Bugger finally new true with the default for null try
3. Standard flowchart Symbols
1. Frame: Flowchart can only have a start box and an end box, the Start box can only have one exit, no entrance, the end box has only one entrance, no exit.
2. Input/Output box: You can input and output multiple numbers, separated by commas. However, the input/output box can only have one entry and one exit.
3. Judging box: There are two exits, but only one entrance.
4. Identifiers
In JS, we need to identify a number of elements in the code, including function names, variable names, and so on.
The name we choose is called an identifier and must follow the following rules:
Identifiers cannot use keywords
Identifiers can contain letters, numbers 0-9, underscores (_), or dollar signs ($).
The first character of an identifier must be a letter, underscore, or dollar sign.
Identifiers are case-sensitive and do not specify a maximum length.
5.JavaScript operator
1. Assignment operator: avascript use the "=" operator to assign a value to a variable or property.
2. Arithmetic operator: The two-dollar addition operator "+" can be added to two numbers, or a string connection operation;
3. "-" Minus, "*" multiplication sign, "/" division sign, "%" modulo;
4. Self-increment: + + for self-increment,-is self-reduction, are monocular operations. operator appears before a variable, called the prefix form, indicating that the variable is automatically added 1 or minus 1 before use.
5. Assignment operator with Operation: The assignment operator can be combined with other operators, such as arithmetic operators.
+ =: for x + = y, that corresponds to x = x + y.
-=: for X-= y, that corresponds to x = XY.
*=: For x *= y, that corresponds to x = x * y.
/=: For x/= y, that corresponds to x = y.
%=: For x%= y, that corresponds to x = x% y.
In addition, x op= y is calculated only once, compared to x = x op y, and the latter is calculated two times.
6. Conditional judgment: Simple if statement if (logic expression) {
Statement ...
}
7. Omit If/else curly Braces
In general, do not omit the curly braces of the IF, else after executing the block, but you can omit the curly braces if the statement execution block has only one line of statements.

JS's Beginner theory

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.