From 563ca0a35e98678e2b7d5f154f31f496851e8d60 Mon Sep 17 00:00:00 2001 From: t7yang Date: Mon, 10 Jan 2022 08:38:07 +0800 Subject: remove code tag inside pre tag for zh-CN --- .../zh-cn/web/javascript/reference/functions/arguments/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'files/zh-cn/web/javascript/reference/functions/arguments') 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");

这个例子定义了一个函数通过一个字符串来创建HTML列表。这个函数唯一正式声明了的参数是一个字符。当该参数为 "u" 时,创建一个无序列表 (项目列表);当该参数为 "o" 时,则创建一个有序列表 (编号列表)。该函数定义如下:

-
function list(type) {
+
function list(type) {
   var result = "<" + type + "l><li>";
   var args = Array.prototype.slice.call(arguments, 1);
   result += args.join("</li><li>");
   result += "</li></" + type + "l>"; // end list
 
   return result;
-}
+}

你可以传递任意数量的参数到该函数,并将每个参数作为一个项添加到指定类型的列表中。例如:

-
var listHTML = list("u", "One", "Two", "Three");
+
var listHTML = list("u", "One", "Two", "Three");
 
 /* listHTML is:
 
 "<ul><li>One</li><li>Two</li><li>Three</li></ul>"
 
-*/
+*/
 

剩余参数、默认参数和解构赋值参数

-- cgit v1.2.3-54-g00ecf