aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/global_objects/array/length/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/array/length/index.html')
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/array/length/index.html8
1 files changed, 4 insertions, 4 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/length/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/length/index.html
index 8f17e9af1f..de5862921d 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/array/length/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/array/length/index.html
@@ -82,25 +82,25 @@ function printEntries(arr) {
<p>下面的例子中,通过数组下标遍历数组元素,并把每个元素的值修改为原值的2倍。</p>
-<pre class="brush: js line-numbers language-js"><code class="language-js">var numbers = [1, 2, 3, 4, 5];
+<pre class="brush: js line-numbers language-js">var numbers = [1, 2, 3, 4, 5];
var length = numbers.length;
for (var i = 0; i &lt; length; i++) {
numbers[i] *= 2;
}
-// 遍历后的结果 [2, 4, 6, 8, 10]</code></pre>
+// 遍历后的结果 [2, 4, 6, 8, 10]</pre>
<h3 id="Example:_Shortening_an_array" name="Example:_Shortening_an_array">截断数组</h3>
<p>下面的例子中,如果数组长度大于 3,则把该数组的长度截断为 3 。</p>
-<pre class="brush: js line-numbers language-js"><code class="language-js">var numbers = [1, 2, 3, 4, 5];
+<pre class="brush: js line-numbers language-js">var numbers = [1, 2, 3, 4, 5];
if (numbers.length &gt; 3) {
numbers.length = 3;
}
console.log(numbers); // [1, 2, 3]
-console.log(numbers.length); // 3</code></pre>
+console.log(numbers.length); // 3</pre>
<h2 id="规范">规范</h2>