aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/functions/arguments/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/javascript/reference/functions/arguments/index.html')
-rw-r--r--files/zh-cn/web/javascript/reference/functions/arguments/index.html8
1 files changed, 4 insertions, 4 deletions
diff --git a/files/zh-cn/web/javascript/reference/functions/arguments/index.html b/files/zh-cn/web/javascript/reference/functions/arguments/index.html
index 04d14b0b4f..b00da02c08 100644
--- a/files/zh-cn/web/javascript/reference/functions/arguments/index.html
+++ b/files/zh-cn/web/javascript/reference/functions/arguments/index.html
@@ -149,24 +149,24 @@ myConcat(". ", "sage", "basil", "oregano", "pepper", "parsley");</pre>
<p>这个例子定义了一个函数通过一个字符串来创建HTML列表。这个函数唯一正式声明了的参数是一个字符。当该参数为 "<code>u</code>" 时,创建一个无序列表 (项目列表);当该参数为 "<code>o</code>" 时,则创建一个有序列表 (编号列表)。该函数定义如下:</p>
-<pre class="brush:js language-js"><code class="language-js">function list(type) {
+<pre class="brush:js language-js">function list(type) {
var result = "&lt;" + type + "l&gt;&lt;li&gt;";
var args = Array.prototype.slice.call(arguments, 1);
result += args.join("&lt;/li&gt;&lt;li&gt;");
result += "&lt;/li&gt;&lt;/" + type + "l&gt;"; // end list
return result;
-}</code></pre>
+}</pre>
<p>你可以传递任意数量的参数到该函数,并将每个参数作为一个项添加到指定类型的列表中。例如:</p>
-<pre class="brush:js language-js"><code class="language-js">var listHTML = list("u", "One", "Two", "Three");
+<pre class="brush:js language-js">var listHTML = list("u", "One", "Two", "Three");
/* listHTML is:
"&lt;ul&gt;&lt;li&gt;One&lt;/li&gt;&lt;li&gt;Two&lt;/li&gt;&lt;li&gt;Three&lt;/li&gt;&lt;/ul&gt;"
-*/</code>
+*/
</pre>
<h3 id="剩余参数、默认参数和解构赋值参数">剩余参数、默认参数和解构赋值参数</h3>