From c40612041809fe289aba58aefa170bbe784aba1f Mon Sep 17 00:00:00 2001 From: t7yang Date: Mon, 10 Jan 2022 08:38:07 +0800 Subject: remove name attribute for zh-CN --- .../reference/global_objects/function/apply/index.html | 14 +++++++------- .../reference/global_objects/function/call/index.html | 2 +- .../reference/global_objects/function/caller/index.html | 10 +++++----- .../reference/global_objects/function/length/index.html | 4 ++-- .../reference/global_objects/function/tosource/index.html | 10 +++++----- .../reference/global_objects/function/tostring/index.html | 6 +++--- 6 files changed, 23 insertions(+), 23 deletions(-) (limited to 'files/zh-cn/web/javascript/reference/global_objects/function') diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/apply/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/apply/index.html index 89706614c4..67a69174e6 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/function/apply/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/function/apply/index.html @@ -17,11 +17,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/apply -

语法

+

语法

func.apply(thisArg, [argsArray])
-

参数

+

参数

thisArg
@@ -34,7 +34,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/apply

调用有指定this值和参数的函数的结果。

-

描述

+

描述

在调用一个存在的函数时,你可以为其指定一个 this 对象。 this 指当前对象,也就是正在调用这个函数的对象。 使用 apply, 你可以只写一次这个方法然后在另一个对象中继承它,而不用在新对象中重复写该方法。

@@ -48,7 +48,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/apply

需要注意:Chrome 14 以及 Internet Explorer 9 仍然不接受类数组对象。如果传入类数组对象,它们会抛出异常。

-

示例

+

示例

用 apply 将数组各项添加到另一个数组

@@ -64,7 +64,7 @@ array.push.apply(array, elements); console.info(array); // ["a", "b", 0, 1, 2] -

使用apply和内置函数

+

使用apply和内置函数

对于一些需要写循环以遍历数组各项的需求,我们可以用apply完成以避免循环。

@@ -106,7 +106,7 @@ for (var i = 0; i < numbers.length; i++) { var min = minOfArray([5, 6, 2, 3, 7]); -

使用apply来链接构造器

+

使用apply来链接构造器

你可以使用apply来链接一个对象构造器,类似于Java。在接下来的例子中我们会创建一个全局Function 对象的construct方法 ,来使你能够在构造器中使用一个类数组对象而非参数列表。

@@ -204,7 +204,7 @@ console.log(myInstance.constructor);              // logs "MyConstructor"

{{Compat("javascript.builtins.Function.apply")}}

-

相关链接

+

相关链接