Today is the second chapter. The so-called lexical structure (lexical structure), is to write the code of the most basic things, variable name, comment, statement separation, etc., this is transcription copy ...
1. Character set, must be Unicode, anyway Unicode is a superset of ASCII, all languages are duly supported, Klingon =. = When I didn't say
2.JavaScript is case-sensitive.
I was impressed by this. Last May, the first write Javascript,document.getelementbyid () wrote the document.getElementById (), the mother egg a whole morning to get not to, a morning ah! So the programming is not trivial, the size of the details and basic principles are to be well mastered. HTML tags are case-insensitive, but considering that HTML is generally used with JS, it is better to have uniform case sensitivity. In the language I have learned, I only remember that the assembly is case-insensitive. More to say, the junior year, the computer composition class write CPU time, a piece of assembly write, hit enter and do not hit Enter is two completely different results.
3. Space, indent, line feed, and format control Deng can be recognized by JavaScript.
This is the same thing as I said in my 2. In addition, JS supports Unicode escape notation. Note that space characters are \u0020, and horizontal tabs are \u0009, although they can sometimes produce similar effects but they are inherently different, as are the newline characters \u000a and carriage return \u000d.
4. Miscellaneous.
Because this section is more broken, it is written as miscellaneous, including comments, identifiers, keywords, semicolons parsing.
Note This javascript is no exception, with//and/**/correspondence lines and multiline annotations.
The identifier is the name, the letter underscore and the dollar symbol can begin, the number is forbidden as the beginning. Keyword cannot be used as an identifier this is common sense, but JavaScript has a normal and strict mode of the point, anyway, I would not intentionally use the reserved word (reserved word) as the identifier.
A semicolon can have no, in the case of the current statement and the next line of statements can not be combined resolution, JS will be in the first line after the semicolon and then resolve. dispensable situation all let it have good, indefinite thing most troublesome, oneself write words a sentence end unify want to take semicolon. (Can return without anything, semicolon can not)
5. Summary
The second chapter is very basic very common sense thing, I still simple record. Slowly will touch the core content of JS, do not hurry.
2. Lexical structure-javascript authoritative guide notes