> For the complete documentation index, see [llms.txt](https://zpliu.gitbook.io/booknote/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zpliu.gitbook.io/booknote/es6/mo-ban-zhi-zi-fu-chuan.md).

# 模板字符串

## 1.在ES6中使用反引&#x53F7;**\`**&#x5C06;普通的字符串进行转换，主要应用有以下

* 定义多行字符串
* 字符串中嵌入变量
* 字符串中调用函数

## 2. 标签模板

> 字符串模板还可以跟在一个函数后面，函数将被用来处理该模板字符串

* str形参是将变量镂空的字符串
* 而vale形参是一个数组存储了对应变量的值

```javascript
function f(str,...value){
    return str"\n"value
}
//使用标签模板进行调用
name="<Amy&MIke>"
f` ${name}.I would like send you some message.</p>`
//返回的结果
//" .I would like send you some message.</p>"
//"<Amy&MIke>"
```
