Open teazean opened 6 years ago
这三种 string sequence escape 在 string, template, identifier, regex 里面的支持情况:
见:http://exploringjs.com/es6/ch_unicode.html#_where-can-escape-sequences-be-used
关于 unicode, 说一点:unicode 规范中,其实有 17(0-16) 个plane:
ataral planes
补充一下关于 js 的 escape sequences 还有一种表达方式: \ooo
,\
跟着 3 个八进制:
\000
: 这种是八进制转码,常见于utf-8,任何小于256均可以使用他的8进制表示,如To use the same example, the copyright symbol ('©') has character code 169, which gives 251 in octal notation, so you could write it as
\251
.
兼容性:
js string 里面有三种编码序列:
\x
后面固定跟两位16进制的字符\u
固定跟四位16进制的字符\u
后面固定格式{}
, 大括号中不限制位数,该种就是为了弥补 \uHHHH 固定四位的不足见: http://exploringjs.com/es6/ch_unicode.html#sec_escape-sequences