For engineers who are familiar with C/C or Java language, JavaScript appears to be flexible, simple and easy to understand, and the requirements for code format are relatively loose. It's easy to learn and apply it to your own code. Because of this, JavaScript coding standards are often underestimated and tinkered with during the development process, eventually becoming a nightmare for subsequent maintainers. The long-term value of a software's existence is directly proportional to the quality of its coding. Coding standards can help us reduce unnecessary troubles in programming. The JavaScript code is sent directly to the customer's browser and meets the customer directly. The quality of the coding should be paid more attention to.
This article briefly talks about coding standards in JavaScript programming and analyzes the reasons. It is hoped that more web developers will pay attention to JavaScript coding standards and software product quality issues.
Foreword
When it comes to C/C and Java coding standards, I believe many engineers are familiar with them. But when it comes to the coding standards of the JavaScript language, you may be laughing. Isn’t JavaScript syntactically flexible? Variables can be used at any time and can be declared at any time; the statement terminator is not required; strings and numbers can also be added; there will be no error if there are more parameters or one less. That's right, when you switch from the strict grammatical regulations of C/C and Java to the JavaScript language, you will feel a lot more free and relaxed. 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 during the writing process, the debugging and maintenance costs of the code will increase invisibly.
JavaScript encoding will be sent directly to the client's browser accordingly. Code specifications are not only a guarantee of code quality, but also affect the long-term reputation of the product. I hope that the specification of the JavaScript programming language will also attract the attention of more friends.
JavaScript Coding Guidelines Recommendations
This article gives some of my own suggestions on the aspects of typesetting, naming, declaration, scope, and the use of some special symbols involved in the JavaScript coding process, based on my personal summary of my study work, and analyzes the reasons. For reference.
JavaScript file reference
JavaScript programs should be placed in .js files as much as possible. When they need to be called, they should be included in the HTML in the form of