From d9e9adb5f80a819fe46349bcf6d1faec734b09cd Mon Sep 17 00:00:00 2001 From: Irvin Date: Wed, 16 Feb 2022 02:07:31 +0800 Subject: remove span tag in zh-CN --- .../functions/arguments/callee/index.html | 4 ++-- .../reference/functions/arguments/index.html | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'files/zh-cn/web/javascript/reference/functions/arguments') diff --git a/files/zh-cn/web/javascript/reference/functions/arguments/callee/index.html b/files/zh-cn/web/javascript/reference/functions/arguments/callee/index.html index c4682f0885..f610b26d54 100644 --- a/files/zh-cn/web/javascript/reference/functions/arguments/callee/index.html +++ b/files/zh-cn/web/javascript/reference/functions/arguments/callee/index.html @@ -88,7 +88,7 @@ sillyFunction();

递归函数必须能够引用它本身。很典型的,函数通过自己的名字调用自己。然而,匿名函数 (通过 函数表达式 或者 函数构造器 创建) 没有名称。因此如果没有可访问的变量指向该函数,唯一能引用它的方式就是通过 arguments.callee

-

下面的例子定义了一个函数,按流程,定义并返回了一个阶乘函数。该例并不是很实用,并且几乎都能够用 命名函数表达式 实现同样结果的例子, and there are nearly no cases where the same result cannot be achieved with .

+

下面的例子定义了一个函数,按流程,定义并返回了一个阶乘函数。该例并不是很实用,并且几乎都能够用 命名函数表达式 实现同样结果的例子, and there are nearly no cases where the same result cannot be achieved with .

function create() {
    return function(n) {
@@ -103,7 +103,7 @@ var result = create()(5); // returns 120 (5 * 4 * 3 * 2 * 1)
 
 

没有替代方案的 arguments.callee

-

当你必须要使用Function构造函数时,下面的例子是没有可以替代 arguments.callee 的方案的,因此弃用它时会产生一个BUG (参看 {{Bug("725398")}}):

+

当你必须要使用Function构造函数时,下面的例子是没有可以替代 arguments.callee 的方案的,因此弃用它时会产生一个BUG (参看 {{Bug("725398")}}):

function createPerson (sIdentity) {
     var oPerson = new Function("alert(arguments.callee.identity);");
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 937a5f7e7c..0cc7216837 100644
--- a/files/zh-cn/web/javascript/reference/functions/arguments/index.html
+++ b/files/zh-cn/web/javascript/reference/functions/arguments/index.html
@@ -156,24 +156,24 @@ myConcat(". ", "sage", "basil", "oregano", "pepper", "parsley");

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

-
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;
-}
+
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:
+/* listHTML is:
 
 "<ul><li>One</li><li>Two</li><li>Three</li></ul>"
 
-*/
+*/
 

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

-- cgit v1.2.3-54-g00ecf