aboutsummaryrefslogtreecommitdiff
path: root/files
diff options
context:
space:
mode:
authorCC2m2 <61456600+CC2m2@users.noreply.github.com>2021-08-30 19:25:49 +0800
committerIrvin <irvinfly@gmail.com>2021-09-04 12:21:17 +0800
commit66840d0d568dc664f9f7c8228c20d90c7566ab2d (patch)
treee2aa4a2f7ae1c2cfde4289a7df5874d687c174ca /files
parent0dc687c9a1afebe26f33183e90b88b267d6950a0 (diff)
downloadtranslated-content-66840d0d568dc664f9f7c8228c20d90c7566ab2d.tar.gz
translated-content-66840d0d568dc664f9f7c8228c20d90c7566ab2d.tar.bz2
translated-content-66840d0d568dc664f9f7c8228c20d90c7566ab2d.zip
Update index.html
Diffstat (limited to 'files')
-rw-r--r--files/zh-cn/web/javascript/reference/template_literals/index.html4
1 files changed, 2 insertions, 2 deletions
diff --git a/files/zh-cn/web/javascript/reference/template_literals/index.html b/files/zh-cn/web/javascript/reference/template_literals/index.html
index 33fb6ebe53..e16b62d850 100644
--- a/files/zh-cn/web/javascript/reference/template_literals/index.html
+++ b/files/zh-cn/web/javascript/reference/template_literals/index.html
@@ -171,13 +171,13 @@ tag`string text line 1 \n string text line 2`;
<p>另外,使用{{jsxref("String.raw()")}} 方法创建原始字符串和使用默认模板函数和字符串连接创建是一样的。</p>
<pre class="brush: js line-numbers language-js"><code class="language-js"><span class="keyword token">var</span> str <span class="operator token">=</span> String<span class="punctuation token">.</span>raw<span class="template-string token"><span class="string token">`Hi\n</span><span class="interpolation token"><span class="interpolation-punctuation punctuation token">${</span><span class="number token">2</span><span class="operator token">+</span><span class="number token">3</span><span class="interpolation-punctuation punctuation token">}</span></span><span class="string token">!`</span></span><span class="punctuation token">;</span>
-<span class="comment token">// "Hi\n5!"</span>
+<span class="comment token">// "Hi\\n5!"</span>
str<span class="punctuation token">.</span>length<span class="punctuation token">;</span>
<span class="comment token">// 6</span>
str<span class="punctuation token">.</span><span class="function token">split</span><span class="punctuation token">(</span><span class="string token">''</span><span class="punctuation token">)</span><span class="punctuation token">.</span><span class="function token">join</span><span class="punctuation token">(</span><span class="string token">','</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
-<span class="comment token">// "H,i,\,n,5,!"</span></code>
+<span class="comment token">// "H,i,\\,n,5,!"</span></code>
</pre>
<h3 id="带标签的模版字面量及转义序列">带标签的模版字面量及转义序列</h3>