doc: update to ES2018

This commit is contained in:
ruanyf
2018-01-29 08:47:04 +08:00
parent 5d5f588899
commit 14c45fe2f5
5 changed files with 134 additions and 108 deletions
+1 -1
View File
@@ -933,7 +933,7 @@ Breve over the h goes \u{h}ere // 报错
模板字符串会将`\u00FF``\u{42}`当作 Unicode 字符进行转义,所以`\unicode`解析时报错;而`\x56`会被当作十六进制字符串转义,所以`\xerxes`会报错。也就是说,`\u``\x`在 LaTEX 里面有特殊含义,但是 JavaScript 将它们转义了。
为了解决这个问题,现在有一个[提案](https://tc39.github.io/proposal-template-literal-revision/),放松对标签模板里面的字符串转义的限制。如果遇到不合法的字符串转义,就返回`undefined`,而不是报错,并且从`raw`属性上面可以得到原始字符串。
为了解决这个问题,ES2018 [放松](https://tc39.github.io/proposal-template-literal-revision/)对标签模板里面的字符串转义的限制。如果遇到不合法的字符串转义,就返回`undefined`,而不是报错,并且从`raw`属性上面可以得到原始字符串。
```javascript
function tag(strs) {