aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/global_objects/function
diff options
context:
space:
mode:
authorIrvin <irvinfly@gmail.com>2022-02-16 02:03:27 +0800
committerIrvin <irvinfly@gmail.com>2022-02-16 02:35:54 +0800
commit012ee621791b6895e637f96e6523027951768f25 (patch)
tree29cfacc0d5092af45870dcc74f22feb8b2664fbf /files/zh-cn/web/javascript/reference/global_objects/function
parentba91b017421b001cd226135612a7bd5dfcd88904 (diff)
downloadtranslated-content-012ee621791b6895e637f96e6523027951768f25.tar.gz
translated-content-012ee621791b6895e637f96e6523027951768f25.tar.bz2
translated-content-012ee621791b6895e637f96e6523027951768f25.zip
remove inline style for zh-CN
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/function')
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/function/apply/index.html12
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/function/bind/index.html2
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/function/call/index.html6
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/function/name/index.html2
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/function/tostring/index.html2
5 files changed, 12 insertions, 12 deletions
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 944791e29c..89706614c4 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
@@ -38,7 +38,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Function/apply
<p>在调用一个存在的函数时,你可以为其指定一个 <code>this</code> 对象。 <code>this</code> 指当前对象,也就是正在调用这个函数的对象。 使用 <code>apply</code>, 你可以只写一次这个方法然后在另一个对象中继承它,而不用在新对象中重复写该方法。</p>
-<p><code>apply</code> 与 {{jsxref("Function.call", "call()")}} 非常相似,不同之处在于提供参数的方式。<code style="font-size: 14px;">apply</code> 使用参数数组而不是一组参数列表。<code>apply</code> 可以使用数组字面量(array literal),如 <code>fun.apply(this, ['eat', 'bananas'])</code>,或数组对象, 如  <code>fun.apply(this, new Array('eat', 'bananas'))</code>。</p>
+<p><code>apply</code> 与 {{jsxref("Function.call", "call()")}} 非常相似,不同之处在于提供参数的方式。<code>apply</code> 使用参数数组而不是一组参数列表。<code>apply</code> 可以使用数组字面量(array literal),如 <code>fun.apply(this, ['eat', 'bananas'])</code>,或数组对象, 如  <code>fun.apply(this, new Array('eat', 'bananas'))</code>。</p>
<p>你也可以使用 {{jsxref("Functions/arguments", "arguments")}}对象作为 <code>argsArray</code> 参数。 <code>arguments</code> 是一个函数的局部变量。 它可以被用作被调用对象的所有未指定的参数。 这样,你在使用apply函数的时候就不需要知道被调用对象的所有参数。 你可以使用arguments来把所有的参数传递给被调用对象。 被调用对象接下来就负责处理这些参数。</p>
@@ -131,7 +131,7 @@ var min = minOfArray([5, 6, 2, 3, 7]);
<p>使用闭包:</p>
-<pre class="brush: js" style="font-style: normal;">Function.prototype.construct = function(aArgs) {
+<pre class="brush: js">Function.prototype.construct = function(aArgs) {
var fConstructor = this, fNewConstr = function() {
fConstructor.apply(this, aArgs);
};
@@ -139,7 +139,7 @@ var min = minOfArray([5, 6, 2, 3, 7]);
return new fNewConstr();
};</pre>
-<p class="brush: js" style="font-style: normal;">使用 Function 构造器:</p>
+<p class="brush: js">使用 Function 构造器:</p>
<pre class="brush: js">Function.prototype.construct = function (aArgs) {
var fNewConstr = new Function("");
@@ -168,7 +168,7 @@ console.log(myInstance.constructor);              // logs "MyConstructor"
<div class="note"><strong>注意:</strong> 这个非native的<code>Function.construct</code>方法无法和一些native构造器(例如<a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/Date" title="JavaScript/Reference/Global_Objects/Date"><code>Date</code></a>)一起使用。 在这种情况下你必须使用<a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/Function/bind#Bound_functions_used_as_constructors" title="JavaScript/Reference/Global_Objects/Function/bind#Bound_functions_used_as_constructors"><code>Function.bind</code></a>方法(例如,想象有如下一个数组要用在Date构造器中: <code>[2012, 11, 4]</code>;这时你需要这样写: <code>new (Function.prototype.bind.apply(Date, [null].concat([2012, 11, 4])))()</code> – -无论如何这不是最好的实现方式并且也许不该用在任何生产环境中).</div>
-<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2>
+<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>
@@ -200,11 +200,11 @@ console.log(myInstance.constructor);              // logs "MyConstructor"
</tbody>
</table>
-<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容性</h2>
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
<p>{{Compat("javascript.builtins.Function.apply")}}</p>
-<h2 id="See_also" name="See_also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2>
+<h2 id="See_also" name="See_also">相关链接</h2>
<ul>
<li>{{jsxref("Functions_and_function_scope/arguments", "arguments ")}} object</li>
diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/bind/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/bind/index.html
index 8940da5ad4..45ee18de46 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/function/bind/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/function/bind/index.html
@@ -212,7 +212,7 @@ var slice = Function.prototype.apply.bind(unboundSlice);
slice(arguments);</pre>
-<h2 id="规范" style="margin-bottom: 20px; line-height: 30px; font-size: 2.14285714285714rem;">规范</h2>
+<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>
diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/call/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/call/index.html
index 5b9fc87b48..5962c181a0 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/function/call/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/function/call/index.html
@@ -101,7 +101,7 @@ var obj = {
greet.call(obj); // cats typically sleep between 12 and 16 hours
</pre>
-<h3 id="使用_call_方法调用函数并且不指定第一个参数(argument)" style="margin-bottom: 20px; line-height: 30px;">使用 <code><strong>call</strong></code> 方法调用函数并且不指定第一个参数(<code>argument</code>)</h3>
+<h3 id="使用_call_方法调用函数并且不指定第一个参数(argument)">使用 <code><strong>call</strong></code> 方法调用函数并且不指定第一个参数(<code>argument</code>)</h3>
<p>在下面的例子中,我们调用了 <code>display</code> 方法,但并没有传递它的第一个参数。如果没有传递第一个参数,<code>this</code> 的值将会被绑定为全局对象。</p>
@@ -127,7 +127,7 @@ function display() {
display.call(); // Cannot read the property of 'sData' of undefined</pre>
-<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2>
+<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>
@@ -165,7 +165,7 @@ display.call(); // Cannot read the property of 'sData' of undefined</pre>
<p>{{Compat("javascript.builtins.Function.call")}}</p>
-<h2 id="See_also" name="See_also" style="margin-bottom: 20px; line-height: 30px;">相关链接</h2>
+<h2 id="See_also" name="See_also">相关链接</h2>
<ul>
<li>{{jsxref("Function.prototype.bind()")}}</li>
diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/name/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/name/index.html
index 61f96599b8..0f7695c49e 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/function/name/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/function/name/index.html
@@ -46,7 +46,7 @@ var object = {
console.log(f.name); // "f"
console.log(object.someMethod.name); // "someMethod"</pre>
-<p style="color: rgb(77, 78, 83);">你可以在 {{jsxref("Operators/Function", "函数表达式", "", 1)}}中定义函数的名称:</p>
+<p>你可以在 {{jsxref("Operators/Function", "函数表达式", "", 1)}}中定义函数的名称:</p>
<pre class="brush:js">var object = {
someMethod: function object_someMethod() {}
diff --git a/files/zh-cn/web/javascript/reference/global_objects/function/tostring/index.html b/files/zh-cn/web/javascript/reference/global_objects/function/tostring/index.html
index 01bf4d2ce7..1ab33a0d1f 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/function/tostring/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/function/tostring/index.html
@@ -176,7 +176,7 @@ Function("a", "b")</pre>
</tbody>
</table>
-<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2>
+<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>