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

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,10 +2,10 @@
<div></div>
<p><strong><code>Uint8ClampedArray</code>8位无符号整型固定数组</strong> 类型化数组表示一个由值固定在0-255区间的8位无符号整型组成的数组如果你指定一个在 [0,255] 区间外的值它将被替换为0或255如果你指定一个非整数那么它将被设置为最接近它的整数。数组内容被初始化为0。一旦数组被创建你可以使用对象的方法引用数组里的元素或使用标准的数组索引语法即使用方括号标记</p>
<h2 id="语法">语法</h2>
<pre class="syntaxbox">new Uint8ClampedArray(length);
<pre><code class="language-javascript">new Uint8ClampedArray(length);
new Uint8ClampedArray(typedArray);
new Uint8ClampedArray(object);
new Uint8ClampedArray(buffer [, byteOffset [, length]]);</pre>
new Uint8ClampedArray(buffer [, byteOffset [, length]]);</code></pre>
<p>关于构造函数语法和参数的更多信息,参见 <em><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#Syntax">TypedArray</a></em></p>
<h2 id="属性">属性</h2>
<dl>
@@ -99,7 +99,7 @@ new Uint8ClampedArray(buffer [, byteOffset [, length]]);</pre>
</dl>
<h2 id="实例">实例</h2>
<p>创建一个 <code>Uint8ClampedArray</code> 的不同方式:</p>
<pre class="brush: js">// From a length
<pre><code class="language-javascript">// From a length
var uintc8 = new Uint8ClampedArray(2);
uintc8[0] = 42;
uintc8[1] = 1337;
@@ -125,7 +125,7 @@ var z = new Uint8ClampedArray(buffer, 1, 4);
var iterable = function*(){ yield* [1,2,3]; }();
var uintc8 = new Uint8ClampedArray(iterable);
// Uint8ClampedArray[1, 2, 3]
</pre>
</code></pre>
<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>
@@ -245,10 +245,10 @@ var uintc8 = new Uint8ClampedArray(iterable);
</div>
<h2 id="兼容性注意事项">兼容性注意事项</h2>
<p>从 ECMAScript 2015 开始, <code>Uint8ClampedArray</code> 构造函数需要用一个 <a href="Reference/Operators/new" title="new 运算符创建一个用户定义的对象类型的实例或具有构造函数的内置对象的实例。"><code>new</code></a> 操作符来构建。从现在开始,不使用 <code>new</code> 来调用一个 <code>Uint8ClampedArray</code> 构造函数将会抛出一个 <a href="Reference/Global_Objects/TypeError" title="TypeError类型错误 对象用来表示值的类型非预期类型时发生的错误。"><code>TypeError</code></a></p>
<pre class="brush: js example-bad">var dv = Uint8ClampedArray([1, 2, 3]);
<pre><code class="language-js example-bad">var dv = Uint8ClampedArray([1, 2, 3]);
// TypeError: calling a builtin Uint8ClampedArray constructor
// without new is forbidden</pre>
<pre class="brush: js example-good">var dv = new Uint8ClampedArray([1, 2, 3]);</pre>
// without new is forbidden</code></pre>
<pre><code class="language-js example-good">var dv = new Uint8ClampedArray([1, 2, 3]);</code></pre>
<h2 id="参见">参见</h2>
<ul>
<li><a href="/en-US/docs/Web/JavaScript/Typed_arrays">JavaScript typed arrays</a></li>