This article describes the coding standards in JavaScript programming and analyzes the reasons. It is expected that more Web developers will pay attention to the JavaScript coding standards and software product quality issues. The JavaScript programming language is the most popular Client scripting language, it has long been familiar to many Web developers. With the advent of the Web2.0 era and the wide application of Ajax technology, JavaScript has gradually attracted more attention. The more you need in your work, the more in-depth study and flexible use of the JavaScript language and the guarantee of the encoding quality.
For Engineers familiar with the C/C ++ or Java language, JavaScript is flexible, easy to understand, and requires relatively loose code formats. It is easy to learn and use it in your own code. Because of this, JavaScript coding standards are often despised. Fixing and complementing during the development process will eventually become a nightmare for subsequent maintenance personnel. The long-term value of software is directly proportional to the coding quality. Coding specifications can help us reduce unnecessary troubles in programming. While JavaScript code is directly sent to the client's browser and directly met with the customer, the quality of code should be paid more attention.
This article describes the coding standards in JavaScript programming and analyzes the reasons. It is expected that more Web developers will pay attention to JavaScript coding standards and software product quality issues.
Preface
I believe many engineers are not unfamiliar with the C/C ++ and Java coding specifications. However, when it comes to the JavaScript language encoding specifications, you may not be able to help. Isn't JavaScript syntax flexible? Variables can be declared at any time; statement Terminator can be avoided; string and number can also be added; one or more parameters will not report an error. Yes, when you switch from the strict C/C ++ and Java syntax rules to the JavaScript language, you will feel a lot of freedom and much easier. Loose syntax is an important feature of JavaScript. It is flexible and easy to understand, and brings a lot of convenience to developers. However, if you do not pay attention to the coding process, the debugging and maintenance costs of the code will be invisible.
JavaScript code will be directly sent to the browser on the client as needed. The code specification not only guarantees the code quality, but also affects the long-term reputation of the product. We hope that the standardization of the JavaScript programming language will also attract more attention from friends.
JavaScript coding specifications
This article provides some suggestions for the formatting, naming, declaration, scope, and use of some special symbols involved in the JavaScript coding process, and analyze the reason for reference.
JavaScript file reference
JavaScript programs should be stored in. js files as much as possible. When you need to call them, use <script src = "filename. js? 6.1.3 ">. If JavaScript code is not specific to the HTML file, avoid writing JavaScript code directly in the HTML file. This will greatly increase the size of HTML files and will not help code compression and Cache Usage.
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.