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

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

@@ -6,8 +6,8 @@
<div><iframe class="interactive interactive-js" frameborder="0" height="250" src="https://interactive-examples.mdn.mozilla.net/pages/js/arraybuffer-constructor.html" width="100%"></iframe></div>
<p class="hidden">The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone <a class="external" href="https://github.com/mdn/interactive-examples" rel="noopener">https://github.com/mdn/interactive-examples</a> and send us a pull request.</p>
<h2 id="语法">语法</h2>
<pre class="syntaxbox">new ArrayBuffer(length)
</pre>
<pre><code class="language-javascript">new ArrayBuffer(length)
</code></pre>
<h3 id="参数">参数</h3>
<dl>
<dt><code>length</code></dt>
@@ -62,7 +62,7 @@
<p>下面的例子创建了一个 8 字节的缓冲区,并使用一个 <a href="Reference/Global_Objects/Int32Array" title="The Int32Array typed array represents an array of twos-complement 32-bit signed integers in the platform byte order. If control over byte order is needed, use DataView instead. The contents are initialized to 0. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation)."><code>Int32Array</code></a> 来引用它:</p>
<pre><code>var buffer = new ArrayBuffer(8);
var view = new Int32Array(buffer);</code>
</pre>
</code></pre>
<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>
@@ -435,10 +435,10 @@ var view = new Int32Array(buffer);</code>
</abbr></span></dt><dd>Compatibility unknown</dd><dt><abbr class="only-icon" title="Experimental. Expect behavior to change in the future."><span>Experimental. Expect behavior to change in the future.</span><i class="ic-experimental"></i></abbr></dt><dd>Experimental. Expect behavior to change in the future.</dd><dt><abbr class="only-icon" title="Non-standard. Expect poor cross-browser support."><span>Non-standard. Expect poor cross-browser support.</span><i class="ic-non-standard"></i></abbr></dt><dd>Non-standard. Expect poor cross-browser support.</dd><dt><abbr class="only-icon" title="See implementation notes."><span>See implementation notes.</span><i class="ic-footnote"></i></abbr></dt><dd>See implementation notes.</dd><dt><abbr class="only-icon" title="User must explicitly enable this feature."><span>User must explicitly enable this feature.</span><i class="ic-disabled"></i></abbr></dt><dd>User must explicitly enable this feature.</dd></dl></section></div><p></p>
<h2 id="兼容性提醒">兼容性提醒</h2>
<p>从 ECMAScript 2015 开始,<code>ArrayBuffer</code> 对象需要用 <a href="Reference/Operators/new" title="new 运算符创建一个用户定义的对象类型的实例或具有构造函数的内置对象的实例。"><code>new</code></a> 运算符创建。如果调用构造函数时没有使用 <code>new</code>,将会抛出 <a href="Reference/Global_Objects/TypeError" title="TypeError类型错误 对象用来表示值的类型非预期类型时发生的错误。"><code>TypeError</code></a>  异常。</p>
<pre class="brush: js example-bad">var dv = ArrayBuffer(10);
<pre><code class="language-js example-bad">var dv = ArrayBuffer(10);
// TypeError: calling a builtin ArrayBuffer constructor
// without new is forbidden</pre>
<pre class="brush: js example-good">var dv = new ArrayBuffer(10);</pre>
// without new is forbidden</code></pre>
<pre><code class="language-js example-good">var dv = new ArrayBuffer(10);</code></pre>
<h2 id="相关链接">相关链接</h2>
<ul>
<li><a href="https://developer.mozilla.orgTyped_arrays">JavaScript 类型数组</a></li>