JavaScript 的换行符和空格符问题

JavaScript08

JavaScript 的换行符和空格符问题,第1张

\0

The NUL character (\u0000).

\b

Backspace (\u0008).

\t

Horizontal tab (\u0009).

\n

Newline (\u000A).

\v

Vertical tab (\u000B).

\f

Form feed (\u000C).

\r

Carriage return (\u000D).

\"

Double quote (\u0022).

\'

Apostrophe or single quote (\u0027).

\\

Backslash (\u005C).

\xXX

The Latin-1 character specified by the two hexadecimal digits XX.

\uXXXX

The Unicode character specified by the four hexadecimal digitsXXXX.

\XXX

The Latin-1 character specified by the octal digits XXX, between 1 and 377. Not supported by ECMAScript v3do not use this escape sequence.

空字符是指长度为0的字符串,也就是""(请注意是引号之间的内容,不包括引号),换句话说就是空白,什么也没有。空格字符就是代表空格的字符,也就是" "(同样不包括引号),地位上与其他可见字符(字母、数字、符号等)是没什么区别的。