Lexical Structureˈleksɪkəl ˈstrʌktʃə词法结构

The lexical structure of a programming language is the set of elementary rules that specifies how you write programs in that language.
程序设计语言的词法结构是一套基本规则,用来详细说明如何用这种语言来编写程序。

It is the lowest-level syntax of a language; it specifies such things as what variable names look like, what characters are used for comments, and how one program statement is separated from the next.
它是一种语言的最低层次(lowest-level)的语法(syntax),指定了变量名(variable names)是什么样的,注释应该使用什么字符,以及语句(statement)之间如何分隔等规则。

Character Setˈkæriktə set字符集

JavaScript programs are written using the Unicode character set.
JavaScript程序是用Unicode字符集编写的。

The 16-bit Unicode encoding can represent virtually every written language in common use on the planet.
16位的Unicode编码可以表示世界上通用的每一种书面语言。

JavaScript represents each character using 2 bytes.
JavaScript程序中的每个字符都是用2个字节表示的。

Case Sensitivitykeis ˌsensɪˈtɪvɪti:大小写敏感

JavaScript is a case-sensitive language.
JavaScript是一种区分大小写的语言。

This means that language keywords, variables, function names, and any other identifiers must always be typed with a consistent capitalization of letters.
这意味着,在输入语言的关键字、变量、函数名以及所有其他的标识符时,都必须采取一致(consistent)的字符大小写形式。

Whitespace and Line Breaks 空白符和换行符

JavaScript ignores spaces, tabs, and newlines that appear between tokens in programs.
JavaScript 会忽略程序中的空格、制表符和换行符。

Optional Semicolonsˈɔpʃənl ˈsemɪˌkəʊlən可选的分号

The semicolon serves to separate statements from each other.
分号主要是为了分隔语句。

Omitting semicolons is not a good programming practice.
省略分号不是一个好的编程习惯。

Commentsˈkɔment注释

Any text between a // and the end of a line is treated as a comment and is ignored by JavaScript.
JavaScript会把处于“//”和一行结尾之间的任何文本都当作注释忽略掉。

Any text between the characters /* and */ is also treated as a comment; these C-style comments may span multiple lines but may not be nested.
此外,/*和*/之间的文本也会被当作注释;这些C型注释可以跨越多行,但是其中不能有嵌套的注释。

Literalsˈlitərəl直接量

A literal is a data value that appears directly in a program.
所谓直接量,就是程序中直接显示出来的数据值。

Identifiersaiˈdentifaiə标识符

In JavaScript, identifiers are used to name variables and functions, and to provide labels for certain loops in JavaScript code.
在JavaScript中,标识符用来命名变量和函数,或者用作JavaScript代码中某些循环(loops)的标签。

The rules for legal identifier names: The first character must be a letter, an underscore(_), or a dollar sign($).
合法的标识符命名规则:第一个字符必须是字母、下划线或美元符号。

Reserved Words 保留字
break do if switch typeof case else in this var catch

false instanceof throw void continue finally new true

while default for null try with delete function return

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
<p>
  These words have special meaning to JavaScript; they are part of the language syntax itself.<br /> 这些关键字对JavaScript来说具有特殊的意义,他们是这种语言中语法自身的一部分。
</p>

<p>
  These are words that you can&#8217;t use as identifiers(variable names, function names, and loop labels) in your JavaScript programs.<br /> 它们在JavaScript程序中不能被用作标识符(变量名、函数名以及循环标记)
</p>

<h6 lang="EN-US">
  <em>Reference</em><span>ˈrefrəns</span>参考
</h6>

<p>
  <a href="https://union-click.jd.com/jdc?e=&#038;p=AyIGZRtYFAcXBFIZWR0yEgZdHV4QABU3EUQDS10iXhBeGlcJDBkNXg9JHUlSSkkFSRwSBl0dXhAAFRgMXgdIMhVADEklbVxFZTUBC3VXQGU9cgxBAGILWStcEAQTD10dXCUHFgZWElMcMiIHVCsJe9qksY2%2B6gnWuIiAk8wlAhsDXRxfFAEaAGUbXxIFGgFWH10WAhIEZRxbHDJHRQ9TBk1dRjdlG1odBBcCVxxrFjIiN1UrWCVAfFUCHVtGURZXAB5YQAdGVFYTXBNXG1JcTloXAhEEUR8PJQATBlES" rel="nofollow" target="_blank">《JavaScript权威指南》</a>
</p>