语法高亮,滚动条美化,设置页面调整

This commit is contained in:
fofolee
2019-04-19 02:41:09 +08:00
parent 1e8f76c000
commit 359d29ee0b
1590 changed files with 12328 additions and 11441 deletions

View File

@@ -3,8 +3,8 @@
<p><strong><code>unshift()</code></strong> 方法将一个或多个元素添加到数组的开头,并返回该数组的新长度。</p>
<div><iframe class="interactive interactive-js" frameborder="0" height="250" src="https://interactive-examples.mdn.mozilla.net/pages/js/array-unshift.html" width="100%"></iframe></div>
<h2 id="Syntax" name="Syntax">语法</h2>
<pre class="syntaxbox">arr.unshift(element1, ..., elementN)
</pre>
<pre><code class="language-javascript">arr.unshift(element1, ..., elementN)
</code></pre>
<h3 id="Parameters" name="Parameters">参数列表</h3>
<dl>
<dt><code>elementN</code></dt>
@@ -18,7 +18,7 @@
<p><code>unshift</code> 方法会在调用它的类数组对象的开始位置插入给定的参数。</p>
<p><code>unshift</code> 特意被设计成具有通用性;这个方法能够通过 <a href="Reference/Global_Objects/Function/call" title="call() 方法调用一个函数, 其具有一个指定的this值和分别地提供的参数(参数的列表)。"><code>call</code></a><a href="Reference/Global_Objects/Function/apply" title="apply() 方法调用一个具有给定this值的函数以及作为一个数组或类似数组对象提供的参数。"><code>apply</code></a> 方法作用于类数组对象上。<span style="line-height: inherit;">不过对于没有 length 属性代表从0开始的一系列连续的数字属性的最后一个的对象调用该方法可能没有任何意义。</span></p>
<p>Please note that, if multiple elements are passed as parameters, they're inserted in chunk at the beginning of the object, in the exact same order they were passed as parameters. Hence, calling unshift with <strong>n</strong> arguments <strong>once</strong>, or calling it <strong>n</strong> times with <strong>1</strong> argument (with a loop, for example), don't yield the same results. See example:</p>
<pre class="syntaxbox">let arr = [4,5,6];
<pre><code class="language-javascript">let arr = [4,5,6];
arr.unshift(1,2,3);
console.log(arr); // [<strong>1, 2, 3</strong>, 4, 5, 6]
@@ -27,9 +27,9 @@ arr.unshift(1);
arr.unshift(2);
arr.unshift(3);
console.log(arr); // [<strong>3, 2, 1</strong>, 4, 5, 6]
</pre>
</code></pre>
<h2 id="示例">示例</h2>
<pre class="brush: js">let arr = [1, 2];
<pre><code class="language-javascript">let arr = [1, 2];
arr.unshift(0); // result of the call is 3, which is the new array length
// arr is [0, 1, 2]
@@ -42,7 +42,7 @@ arr.unshift([-4, -3]); // the new array length is 6
arr.unshift([-7, -6], [-5]); // the new array length is 8
// arr is [ [-7, -6], [-5], [-4, -3], -2, -1, 0, 1, 2 ]
</pre>
</code></pre>
<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>