JavaScript dataView.setBigInt64() Method

This setBigInt64() method in Javascript is used to store a signed 64-bit integer (long long) value at the particular byte offset from the start of the DataView.
Syntax:
dataview.setBigInt64(byteOffset, val [, littleEndian])
Parameters: This method accepts three parameters.
- byteOffset: This parameter specifies the offset, in bytes, from the start of the view to read the data.
- val: This parameter specifies the value to set as a BigInt.
- littleEndian: This is an optional parameter. If it is true then indicates if the 64-bit int is stored in little- or big-endian format. If set to false or not-defined, then a big-endian value is read.
Return Value: This function does not return anything.
Example 1: In this example, the value set is 7 at offset 0.
Javascript
<script>Â Â Â Â var buffr = new ArrayBuffer(8);Â Â Â Â var dView = new DataView(buffr);Â Â Â Â dView.setBigInt64(0, 7n);Â Â Â Â document.write(dView.getBigInt64(0));</script> |
Output:
7
Example 2: In this example, the value set is 789 at offset 4.
Javascript
<script>    // create an ArrayBuffer with a size in bytes    const buffr = new ArrayBuffer(16);    // constant value to set    const val = 789n;    const dView = new DataView(buffr);    dView.setBigInt64(4, val);    document.write(dView.getBigInt64(4));</script> |
Output:
789
We have a complete list of Javascript Boolean and Dataview Methods, to check those please go through Javascript Boolean and DataView Complete Reference article.
Supported Browsers:
- Chrome
- Edge
- Firefox
- Opera
- Safari
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, zambiatek Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!



