Js FAQ case-sensitive single quotes, which are used to single quotes in double quotation marks-js. -The attribute value of html must be enclosed in double quotation marks. -Single quotation marks can contain double quotation marks, which can also contain single quotation marks. Brackets can be separators or expressions. -(Function... SyntaxHighlighter. all ();
Common js Problems
Case Sensitive
Single quotation marks, double quotation marks
-Single quotes are used in js.
-The attribute value of html must be enclosed in double quotation marks.
-Single quotation marks can contain double quotation marks, which can also contain single quotation marks.
Brackets
-It can be a separator or expression. As follows:
-(Function (){})()
-The onload function is loaded when the entire page is loaded. (If there are many images, it will be very slow. You can rewrite the window. onload function to execute the function at the same time when loading the text)
Function call and reference
Var foo = functionName ();
Var foo1 = functionName;
The former indicates the return value of the function, and the latter indicates a reference to the function. For example, window. onload = functionName;
Newline
One line in js is the default statement and cannot contain a forced line break. If you want to wrap a line, you can add a backslash at the end of the line or use a string connector +. We recommend that you use the latter.
Semicolon and braces (optional)
The semicolon can be left blank, but we recommend that you add it for code readability.
Heavy Load
Js does not support overloading. If two functions have the same name (not related to parameters), the following functions will overwrite the above functions.
If function alert () {}; appears in the Code, the core function alert is overwritten.
Therefore, do not use the name of the core function when naming a function.
Scope and Closure
Scope: the code space that has access permissions to a property or method.
Closure-an internal function can access the attributes of an external function even after the external function is executed and terminated.
The related code is as follows:
====================================
New Document