diff options
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/dataview/getbigint64/index.html')
-rw-r--r-- | files/zh-cn/web/javascript/reference/global_objects/dataview/getbigint64/index.html | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/dataview/getbigint64/index.html b/files/zh-cn/web/javascript/reference/global_objects/dataview/getbigint64/index.html new file mode 100644 index 0000000000..cf90669761 --- /dev/null +++ b/files/zh-cn/web/javascript/reference/global_objects/dataview/getbigint64/index.html @@ -0,0 +1,91 @@ +--- +title: getBigInt64() +slug: Web/JavaScript/Reference/Global_Objects/DataView/getBigInt64 +tags: + - DataView + - JavaScript + - Prototype + - getBigInt64() + - 大整型 +translation_of: Web/JavaScript/Reference/Global_Objects/DataView/getBigInt64 +--- +<div>{{JSRef}}</div> + +<div></div> + +<p><strong><code>getBigInt64()</code></strong> 方法从 {{jsxref("DataView")}}开始获取一个指定偏移量的有符号64位整数 (long long) 。</p> + +<div>{{EmbedInteractiveExample("pages/js/dataview-getbigint64.html")}}</div> + + + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox"><var>dataview</var>.getBigInt64(byteOffset [, littleEndian])</pre> + +<h3 id="参数">参数</h3> + +<dl> + <dt>byteOffset</dt> + <dd>偏移量,以字节为单位。指明视图开始读取数据的偏移量。</dd> + <dt>littleEndian</dt> + <dd>{{optional_inline}} 指明该64位整型数值的存储方式( {{Glossary("Endianness", "大小端模式")}}) 。 如果为 <code>false</code> 或 <code>undefined</code>, 则按大端方式读取数据。</dd> +</dl> + +<h3 id="返回值">返回值</h3> + +<p>一个 {{jsxref("BigInt")}}.</p> + +<h3 id="异常抛出">异常抛出</h3> + +<dl> + <dt>{{jsxref("RangeError")}}</dt> + <dd>如果 <code>byteOffset</code> 设置的偏移量超出了视图的范围,则抛出该异常。</dd> +</dl> + +<h2 id="简介">简介</h2> + +<ul> + <li>没有对齐约束;</li> + <li>可以从任何偏移量获取多字节值。</li> +</ul> + +<h2 id="例子">例子</h2> + +<h3 id="使用_getBigInt64_方法">使用 <code>getBigInt64</code> 方法</h3> + +<pre class="brush:js">var buffer = new ArrayBuffer(8); +var dataview = new DataView(buffer); +dataview.getBigInt64(0); // 0n +</pre> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">规范版本</th> + <th scope="col">规范状态</th> + <th scope="col">注解 </th> + </tr> + <tr> + <td><a href="https://tc39.github.io/proposal-bigint/#sec-dataview.prototype.getbigint64">DataView.prototype.getBigInt64 proposal</a></td> + <td></td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("javascript.builtins.DataView.getBigInt64")}}</p> + +<h2 id="另请参阅">另请参阅</h2> + +<ul> + <li>{{jsxref("DataView")}}</li> + <li>{{jsxref("ArrayBuffer")}}</li> + <li>{{jsxref("BigInt")}}</li> +</ul> |