JavaScript Syntax Summary

Source: Internet
Author: User
Tags logical operators object model

One: Grammar

JavaScript: A client-side scripting language based on object and event-driven;

Consists of the following three:

1,ecmascript (a European computer Manufacturers Association by the ECMA International, formerly the European Association of Computer manufacturers, through the ECMA-262 standardized scripting language);

2,bom (abbreviation for browser object model, referred to as a browser-based);

The 3,dom (Document Object model, the documentation-based, or DOM) is the standard programming interface recommended by the Organization for the processing of extensible flag languages.

1) statement; execution order; annotation; introduction method; variable definition;

2) data type;

A:string, String type, enclose a string of characters (numbers, letters, symbols) in single and double quotes;

B:number, numeric type, integer value, floating point number;

C:boolean, Boolean type, value is true/false;

d:undefined,undefined type, only Undefined a value, the default value for the variable;

E:null, there is only one special value null, which represents an empty object pointer, which can be set to Null to clear the variable;

F:object, object, reference type, also called complex type.

3) logical operators;

A: arithmetic operator: +,-,*,/,%;

B: relational operator: >,>=,<,<=,==,===,! =,!==;

C: logical operator in:&& (with), | | (OR),! (non);

D: assignment operator: =,+=,-=,*=,/=,%=;

E: string and variable concatenation: "+";

F: Self-added (+ +), self-reduction (-);

4) type loading and replacement;

String conversion numbers: parseint ()---Convert other types to integers, parsefloat ()---Convert other types to floating-point (decimals);

5) Select the structure;

Program three flow control: order, Branch (select), cycle;

1) If statement:

Single branch; double branch;

multiple branches; nested structures;

Note: If after () cannot be omitted, the branch {} cannot be omitted; If nesting does not exceed three layers

A: Single branch--if conditional judgment statement;

B: Multi-branch;

  

2) Swith statement;

   

Note: The default branch must be written in the Swith statement to prevent ambiguity in the subsequent maintenance;

Put more execution probabilities in front (if,case)

If else and swith differ, the former is branched with less nesting and the latter with more branches.

6) Condition Operator: The only three-wood operator, which requires three operands;

Format: expression 1? Expression 2: Expression 3;

The expression 1 is first, if true, the expression 2 is executed, whereas the expression 3 is executed;

7) cyclic structure;

Loop: Repeat one thing, given the conditions set up, repeated execution, know that the condition is not established failure stop.

A:while cycle;

B:do while loop;

C:for cycle;

D:break and Countinue;

JavaScript Syntax Summary

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.