1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-24 18:32:22 +00:00

docs(string-methods): refact String.raw()

This commit is contained in:
ruanyf 2019-06-17 15:28:34 +08:00
parent 5a773c8c81
commit 95d62ea56c

View File

@ -43,6 +43,8 @@ String.raw`Hi\u000A!`;
```javascript
String.raw`Hi\\n`
// 返回 "Hi\\\\n"
String.raw`Hi\\n` === "Hi\\\\n" // true
```
`String.raw()`方法可以作为处理模板字符串的基本方法,它会将所有变量替换,而且对斜杠进行转义,方便下一步作为字符串来使用。