--- title: DataView.prototype.setBigInt64() slug: Web/JavaScript/Reference/Global_Objects/DataView/setBigInt64 tags: - BigInt - DataView - setBigInt64 translation_of: Web/JavaScript/Reference/Global_Objects/DataView/setBigInt64 ---
setBigInt64()
方法在距{{jsxref("DataView")}} 的起始位置的指定字节偏移处存储一个带符号的64位整数(long long类型)值。
dataview.setBigInt64(byteOffset, value [, littleEndian])
2n ** (64n -1n) - 1n
(9223372036854775807n
)。当发生溢出时,将会变成负数(-9223372036854775808n
)。false
或者未指定(undefined
),将会写入一个big-endian(大端模式:高位字节排放在内存的低地址端,低位字节排放在内存的高地址端)格式的数值。{{jsxref("undefined")}}.
byteOffset
设置导致存储该数值时超出了视图的末尾位置,将会抛出错误。setBigInt64
方法var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.setBigInt64(0, 3n); dataview.getBigInt64(0); // 3n
规范 | 状态 | 解释 |
---|---|---|
{{SpecName('ESDraft', '#sec-dataview.prototype.setbigint64', 'DataView.prototype.setBigInt64()')}} | {{Spec2('ESDraft')}} |
{{Compat("javascript.builtins.DataView.setBigInt64")}}