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

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

@@ -2,12 +2,12 @@
<div></div>
<p>The <strong><code>Uint16Array</code></strong> typed array represents an array of 16-bit unsigned integers in the platform byte order. If control over byte order is needed, use <a href="Reference/Global_Objects/DataView" title="DataView 视图是一个可以从 ArrayBuffer 对象中读写多种数值类型的底层接口,使用它时,不用考虑不同平台的字节序问题。"><code>DataView</code></a> instead. The contents are initialized to <code>0</code>. 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).</p>
<h2 id="语法">语法</h2>
<pre class="syntaxbox">new Uint16Array(); // ES2017 新加入的
<pre><code class="language-javascript">new Uint16Array(); // ES2017 新加入的
new Uint16Array(length);
new Uint16Array(typedArray);
new Uint16Array(object);
new Uint16Array(buffer [, byteOffset [, length]]);
</pre>
</code></pre>
<p>获取有关构造函数语法和参数的更多信息,访问<em><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#Syntax">TypedArray</a></em></p>
<h2 id="属性">属性</h2>
<dl>
@@ -101,7 +101,7 @@ new Uint16Array(buffer [, byteOffset [, length]]);
</dl>
<h2 id="Examples">Examples</h2>
<p>创建 <code>Uint16Array的不同方法</code>:</p>
<pre class="brush: js">// From a length
<pre><code class="language-javascript">// From a length
var uint16 = new Uint16Array(2);
uint16[0] = 42;
console.log(uint16[0]); // 42
@@ -125,7 +125,7 @@ var z = new Uint16Array(buffer, 0, 4);
var iterable = function*(){ yield* [1,2,3]; }();
var uint16 = new Uint16Array(iterable);
// Uint16Array[1, 2, 3]
</pre>
</code></pre>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
<tbody>
@@ -306,10 +306,10 @@ var uint16 = new Uint16Array(iterable);
</abbr></span></dt><dd>Compatibility unknown</dd></dl></section></div><p></p>
<h2 id="Compatibility_notes">Compatibility notes</h2>
<p>Starting with ECMAScript 2015, <code>Uint16Array</code> constructors require to be constructed with a <a href="Reference/Operators/new" title="new 运算符创建一个用户定义的对象类型的实例或具有构造函数的内置对象的实例。"><code>new</code></a> operator. Calling a <code>Uint16Array</code> constructor as a function without <code>new</code>, will throw a <a href="Reference/Global_Objects/TypeError" title="TypeError类型错误 对象用来表示值的类型非预期类型时发生的错误。"><code>TypeError</code></a> from now on.</p>
<pre class="brush: js example-bad">var dv = Uint16Array([1, 2, 3]);
<pre><code class="language-js example-bad">var dv = Uint16Array([1, 2, 3]);
// TypeError: calling a builtin Uint16Array constructor
// without new is forbidden</pre>
<pre class="brush: js example-good">var dv = new Uint16Array([1, 2, 3]);</pre>
// without new is forbidden</code></pre>
<pre><code class="language-js example-good">var dv = new Uint16Array([1, 2, 3]);</code></pre>
<h2 id="See_also">See also</h2>
<ul>
<li><a href="/en-US/docs/Web/JavaScript/Typed_arrays" title="en/JavaScript typed arrays">JavaScript typed arrays</a></li>