JavaScript specification for front-end coding style specifications and front-end javascriptJavaScript specification global namespace pollution and IIFE
Always wrap the code into an IIFE (Immediately-Invoked Function Expression) to create an independent and isolated definition domain. This action prevents global namespace contamination.
IIFE also ensures that your code is not easily modified by the code in o
JavaScript: JavaScript coding errors will cause network disasters. Javascript tutorial
March 26, according to malware researchers, web developers with JavaScript coding errors and experience using new programming technologies wil
Document the more useful coding specifications (the guidelines are based on the Java language encoding specification and JAVASCRIPT programming specifications, combined with the personal experience and preferences of the author Nicholos Zakas).Some specifications for formatting (including indentation, line length, operator spacing, bracket spacing, object Direct volume, comments, single-line comments, multi
is difficult to understand is usually annotated.Code that may be mistaken for error, need to add commentsDocument commentsDocument annotations are not part of JavaScript from a technical point of view, but they are a common practice. Document comments One of the most popular formats is from the Javadoc document grid: Multiline comments start with/**, followed by descriptive information, which uses the @ symbol to represent one or more properties. Tak
[Study Notes] JavaScript coding specifications-blank, learning notes javascript
Use a tab to set two (4) spaces. This function can be configured in IDE. According to actual requirements.
// badfunction() {∙∙∙∙var name;}// badfunction() {∙var name;}// goodfunction() {∙∙var name;}
Leave a space before the braces on the left.
// badfunction test(){console.log('te
constants, a common naming convention arises. This convention is derived from the C language, which uses uppercase letters and underscores to name and underline words, such as:var max_count = 10;var URL = "http://www.nczonline.net/";It is important to note that this is only a variable with a different naming convention applied.constructor functionIn JavaScript, a constructor is simply a function prefixed with the new operator, which is used to create
) {d=a%c; a+= D;} 5. The function name of the constructor to capitalize the first letterJavaScript does not have a "class" concept, but it can be known as a constructor called with new:var adam = new Person ();This constructor is not like Java or C, and is placed in the definition of the class, so it looks the same as the other functions. To differentiate a constructor, you can capitalize the first letter of the function name: Functions Myconstructor () {...}function myFunction () {...}We'll
[Study Notes] JavaScript coding specification-type, Study Notes javascript
Type
Basic Type: when accessing the basic type, the type value should be operated directly.
String number boolean null undefined
Var a = 0; var B = a; B = 8; console. log (a, B); // 0, 8
Note:
1. Call the console in JavaScript
[Note] JavaScript coding specifications-comma and semicolon, and javascript semicolon
Do not use a comma before a statement.
// Badvar story = [once, upon, aTime]; // goodvar story = [once, upon, aTime];
Do not include extra commas: this will cause some problems in the weird modes of IE6, IE7, and IE9. At the same time, in some implementations of ES3, extra
JavaScript programming language, as the most popular Client scripting language, 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
The JavaScript programming language, as the most popular client-side scripting language, has long been known 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 work on the JavaScript language, the more you use it flexibly, and the quality of your
Web page Production WEBJX article introduction: for engineers who are familiar with C + + or the Java language, JavaScript is flexible, easy to understand, and relatively loosely formatted for code. It's easy to learn and apply to your own code. Also because of this, JavaScript coding norms are often despised, the development process of tinkering, and eventually
For engineers who are familiar with C + + or the Java language, JavaScript is flexible, easy to understand, and relatively loosely formatted for code. It's easy to learn and apply to your own code. Also because of this, JavaScript coding norms are often despised, the development process of tinkering, and eventually evolved into a follow-up maintenance personnel n
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
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
have more comments than the code.
The most important habit, however, is to keep comments updated in a timely manner, because outdated comments are more misleading than those without comments.Additional reading
The topic list of this article is as follows:
How should we understand the working principle of the JavaScript engine?
JavaScript exploration: the importance of writing maintainable code
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
> 0) {HTML + = ', ';}HTML + = itemhtml (Items[i]);}HTML + = ' return HTML;}
You can do this in the following ways:function listhtml (items) {var html = [];for (var i = 0, len = items.length; i Html[i] = itemhtml (Items[i]);}Return ' }
Description: The array is used as the string constructor and then converted to a string by a join ('). However, as the assignment operation is faster than the push () of the array, the assignment operation is used as much as possible."References"[1
The implementation method of UTF-8 coding through javascript, javascriptutf-8
Javascript character set:
Javascript programs are written using the Unicode Character Set. Unicode is a superset of ASCII and Latin-1, and supports almost all languages on the earth. ECMAScript3 requires
On the ASP (Server.URLEncode), PHP (UrlEncode ()) function encoding results, or through the ASP, PHP and other dynamic languages directly to write cookies in the Chinese characters, with JS Read, will encounter a coding problem, That is, the final string is urlencode encoded, and there is a need to read the data from JS on the client.
And this article, I would like to talk about how in JS through the system with the function to solve this problem.
A
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.