setBigUint64()
方法在距DataView 的起始位置的指定字节偏移处存储一个无符号的64位整数(unsigned long long类型)值。
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 https://github.com/mdn/interactive-examples and send us a pull request.
语法
dataview.setBigUint64(byteOffset, value [, littleEndian])
参数说明
- byteOffset
- 字节偏移量,为从视图的起始位置到数据存储位置的字节字节偏移量。
- value
-
作为一个BigInt类型设置的数值。满足一个无符号的64位整数的最大可能数值是
2n ** 64n - 1n
(18446744073709551615n
)。当发生溢出时,将会变成0。 - littleEndian
- 为可选参数,表示这个64位整数是否以little-endian 或者big-endian格式存储。如果设置为false 或者未指定(undefined),将会写入一个big-endian(大端模式:高位字节排放在内存的低地址端,低位字节排放在内存的高地址端)格式的数值。
返回值
抛出的错误
-
RangeError
- 如果 byteOffset设置导致存储该数值时超出了视图的末尾位置,将会抛出错误。
例子
使用 setBigUint64
方法
var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.setBigUint64(0, 3n); dataview.getBigUint64(0); // 3n
相关规范
规范 | 状态 | 解释 |
---|---|---|
ECMAScript Latest Draft (ECMA-262) DataView.prototype.setBigUint64() |
Draft |
浏览器兼容性
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out
https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | Server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
setBigUint64 |
Chrome Full support 67 | Edge No support No | Firefox Full support 68 | IE No support No | Opera Full support 54 | Safari No support No | WebView Android Full support 67 | Chrome Android Full support 67 | Firefox Android Full support 68 | Opera Android Full support 48 | Safari iOS No support No | Samsung Internet Android Full support 9.0 | nodejs Full support 10.4.0 |
Legend
- Full support
- Full support
- No support
- No support