转义字符

基本类型 / 字符类型

// \' 表示单引号。
let c1 = '\'';

// \" 表示双引号。
let c2 = '\"';

// \\ 表示反斜杠。
let c3 = '\\';

// \0 表示空字符。
let c4 = '\0';

// \b 表示退格符。
let c5 = '\b';

// \n 表示换行符。
let c6 = '\n';

// \r 表示回车符。
let c7 = '\r';

// \t 表示水平制表符。
let c8 = '\t';

// \v 表示垂直制表符。
let c9 = '\v';

// \x 表示 Unicode 字符的十六进制值。
let c10 = '\x41'; // 符号 A

console.log("c1 = \"" + c1 + "\".");
console.log("c2 = \"" + c2 + "\".");
console.log("c3 = \"" + c3 + "\".");
console.log("c4 = \"" + c4 + "\".");
console.log("c5 = \"" + c5 + "\".");
console.log("c6 = \"" + c6 + "\".");
console.log("c7 = \"" + c7 + "\".");
console.log("c8 = \"" + c8 + "\".");
console.log("c9 = \"" + c9 + "\".");
console.log("c10 = \"" + c10 + "\".");