[TOC]

Whitespace

Whitespace can take the form of formatting characters or comments.

var that = this;

the space between var and that cannot be removed, but the other spaces can be removed.

人话表示就是,其他语言怎么用空格,JavaScript就怎么用。

Names

人话表示,跟其他编程语言一样,不要用系统自带的一些会引起冲突的名字就好。

Numbers

JavaScript has a single number type. Internally, it is represented as 64-bit floating point, the same as Java’s double. Unlike most other programming languages, there is no separate integer type, so 1 and 1.0 are the same value.

人话表示就是,JavaScripts的数据都是以64位的浮点数存储的。在JavaScript里只要数字是一样的,就是一样的。

Strings

A string literal can be wrapped in single quotes or double quotes.The \ (backslash) is the escape character. JavaScript was built at a time when Unicode was a 16-bit character set, so all characters in JavaScript are 16 bits wide. JavaScript does not have a character type. To represent a character, make a string with just one character in it.

在JavaScript中,每一个字符都是16位的,由Unicode编码。

image.png
The escape sequences allow for inserting characters into strings that are not normally permitted, such as backslashes, quotes, and control characters. The \u convention allows for specifying character code points numerically.
“A” === “\u0041”
Strings have a length property. For example, “seven”.length is 5

Statements

image.png

A compilation unit contains a set of executable statements. In web browsers, each