1. Use 4 space characters as an indent level.
2. Do not omit semicolons. ---> Automatic insertion of the semicolon mechanism is complex and difficult to remember.
3. The length of a line is limited to 80 characters.
4. Typically, after the operator wraps, the next line increments by two levels of indentation.
5. When assigning a value to a variable, the position of the second row should remain aligned with the position of the assignment operator.
6. Empty lines add a blank line between the local variable and the first statement between the methods before the logical fragment is inserted between the two lines to improve readability.
7. Naming rules, using camel-type lowercase, which starts with lowercase letters, each subsequent word is capitalized.
8. Constants use uppercase letters and underscores.
9. The constructor is named using the Big hump method.
10. Strings can use single quotes or double quotes, which is best used in a style from beginning to end. Using the \ Number to create a multiline string is an illegal JavaScript syntax but it is true that you can create multiple lines of string in your code. Use the + sign to replace \
var longstring = ""
Correct usage:
var longstring = "Here's the story, of a man" + "named Brady.";
One. Null
Scenarios that use NULL:
1) used to initialize a variable, the variable may be assigned to an object.
2) For comparison with an already initialized object, this variable can or may not be an object.
3) used as a parameter when the function's parameters are expected to be an object.
4) When the return value of a function is expected to be a pair of images, it is used as the return value.
scenarios where null should not be used:
1) do not use NULL to detect if a parameter is passed in.
2) do not use NULL to detect a variable that is initialized.
Null should be considered a placeholder for the object.
nudefined.
var Person ; typeof // ' undefined ' typeof // "undefined"
13. Object Direct volume creation objects can directly and efficiently complete the task of creating objects.
14. Create an array using the array direct amount. Do not approve the display array constructor to create arrays.
1.js programming style. ---to write maintainable javascript