mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2026-02-27 17:44:35 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
<div></div>
|
||||
<p>静态方法 <code><strong>Reflect</strong></code><strong><code>.apply()</code></strong> 通过指定的参数列表发起对目标(target)函数的调用。</p>
|
||||
<h2 id="句法">句法</h2>
|
||||
<pre class="syntaxbox">Reflect.apply(target, thisArgument, argumentsList)
|
||||
</pre>
|
||||
<pre><code class="language-javascript">Reflect.apply(target, thisArgument, argumentsList)
|
||||
</code></pre>
|
||||
<h3 id="参数">参数</h3>
|
||||
<dl>
|
||||
<dt>target</dt>
|
||||
@@ -17,11 +17,11 @@
|
||||
<p>如果target对象不可调用,抛出<a href="Reference/Global_Objects/TypeError" title="TypeError(类型错误) 对象用来表示值的类型非预期类型时发生的错误。"><code>TypeError</code></a>。</p>
|
||||
<h2 id="描述">描述</h2>
|
||||
<p>该方法与ES5中<a href="Reference/Global_Objects/Function/apply" title="apply() 方法调用一个具有给定this值的函数,以及作为一个数组(或类似数组对象)提供的参数。"><code>Function.prototype.apply()</code></a>方法类似:调用一个方法并且显式地指定this变量和参数列表(arguments) ,参数列表可以是数组,或类似数组的对象。</p>
|
||||
<pre class="brush: js">Function.prototype.apply.call(Math.floor, undefined, [1.75]);</pre>
|
||||
<pre><code class="language-javascript">Function.prototype.apply.call(Math.floor, undefined, [1.75]);</code></pre>
|
||||
<p>使用 <code>Reflect.apply</code> 方法会使代码更加简洁易懂。</p>
|
||||
<h2 id="使用示例">使用示例</h2>
|
||||
<h3 id="Reflect.apply()"><code>Reflect.apply()</code></h3>
|
||||
<pre class="brush: js">Reflect.apply(Math.floor, undefined, [1.75]);
|
||||
<pre><code class="language-javascript">Reflect.apply(Math.floor, undefined, [1.75]);
|
||||
// 1;
|
||||
|
||||
Reflect.apply(String.fromCharCode, undefined, [104, 101, 108, 108, 111]);
|
||||
@@ -32,7 +32,7 @@ Reflect.apply(RegExp.prototype.exec, /ab/, ["confabulation"]).index;
|
||||
|
||||
Reflect.apply("".charAt, "ponies", [3]);
|
||||
// "i"
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table class="standard-table">
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user