JS Programming Style

Source: Internet
Author: User

1. Indent level, four spaces are recommended.

2. Use a semicolon at the end of the statement.

3. The line length does not exceed 80 characters.

4. Add two indents, or 8 spaces, for line breaks.

5. Make reasonable use of the empty line.

6. Name:

6.1 variables, camel case, start with a lowercase letter, the first word in the back is capitalized, such as: Var thisismyname.

6.2 Variable prefixes are generally used nouns, function prefixes with verbs (functions are also camel-type)

6.3 constant var max_count = 10;

6.4 Constructors are usually camel-style with uppercase letters. such as person

7. Double quotation marks are recommended for strings.

8. Comments, single line//, multiple lines/*/... */, Documentation Comments/** .... **/

9. All statement blocks should be wrapped with {} curly braces.

10.

JS Programming Style

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.