0003. In-depth understanding of JavaScript Series Learning: Basic points for writing high-quality JavaScript code

Source: Internet
Author: User

Recommended Uncle Tom Blog Garden in-depth understanding of JavaScript series

This article source: http://www.cnblogs.com/TomXu/archive/2011/12/28/2286877.html

Write maintainable code (Writing maintainable code) i.e.

Blog Park "Walker's technical Notes" in the Reference code specification and read and write maintainability can be used as a reference, I also reproduced the article to their own blog Park http://www.cnblogs.com/wolongjv/articles/5937898.html

Summarized as:

1. Readability (Code style consistent, code logic clear, just the right comment)

2. Maintainability (code not to write dead)

The small difference between implicit global variables and well-defined global variables is the delete ability to make variables undefined by using operators.

    • Global variables created by VAR (created in programs other than functions) cannot be deleted.
    • Implicit global variables created without VAR (regardless of whether they were created in a function) can be deleted.
//define three global variablesvarGlobal_var = 1; Global_novar= 2;// Negative(function() {Global_fromfunc= 3;// Negative}());//attempt to deleteDeleteGlobal_var;//falseDeleteGlobal_novar;//trueDeleteGlobal_fromfunc;//true//Test the deletiontypeofGlobal_var;//"Number"typeofGlobal_novar;//"undefined"typeofGlobal_fromfunc;//"undefined"

The previous JS variable mentions a variable declared with the consent of Var
var car = "PORSCHE", name = ' Cayenne ', price = 888000;

0003. In-depth understanding of JavaScript Series Learning: The basics of writing high-quality JavaScript code

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.