JavascriptCase Sensitive(Keyword, function name, variable name, etc.), the first character of the identifier must beLetter, underline, or $ characterThe subsequent characters can contain numbers.
If the voice indicates that the variable is not assigned a value, the default value is undefined.
Javascript does not distinguish between integer and floating point types,All numbers are represented in the floating point type.Of
The string type is enclosed in single or double quotation marks.
Escape characters
Escape Sequence characters
/B Return
/F form feed
/N line feed
/R press ENTER
/T horizontal hop (Ctrl-I)
/'Single quotes
/"Double quotation marks
// Backslash
Note: When Using escape characters in the document. writeln () function, the script must be placed in the <pre> </pre> label pair.
Javascript hasAbsolutely equalConcept, "=" indicates equal to, only determines the literal value, does not involve the data type, for example, "17" = 17, the return value is true, "=" indicates that it is absolutely equal to, and involves data type comparison. For example, "17" = 17, and the return value is false.
The typeof function is used to return the Data Type of Its operands,
var a=3;var b="name";var c=null;
Typeof a Returns number, typeofb returns string, typeof c returns object,
Typeof can return the following types: number, string, boolean, object, function, and undefined.
The following two statements are specifically used for object statements:
For... in Loop
Var objects = {user: "clf", age: "25", QQ: "496221132"}; for (var item in objects) {document. write ("attribute:" + item + "=" + objects [item] + "<B/r> ");}
Result:
Attribute: user = clf
Property: age = 25
Property: QQ = 496221132
With statement, used to avoid repeated use of the specified object reference
Var date_time = new Date (); with (date_time) {alert (getYear () + "/" + getMonth () + 1 + "/" + getDate ()); // if it is not in the with statement block, it should be alert (date_time.gerYear ())...}
Use parentheses instead of braces to create arrays in javascript,
var arr = new Array('a','b','c');var arr2 = new Array(7);
Same-origin policy
The same-origin policy is the main security policy of javascript. It indicates that a script can only read the properties of windows or documents with the same source.
The same-origin check is used to check whether two URLs belong to the same source. The following conditions must be met:
1. The protocol is the same
2. The port is the same
3. The domain name is the same