Skip to content
Related Articles

Related Articles

JavaScript DataView.setBigUint64() Method

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 21 Feb, 2022

The setBigUint64() method is used to store an unsigned 64-bit integer (unsigned long long) value at the particular byte offset from the start of the DataView.


dataview.setBigUint64(byteOffset, val [, littleEndian])

Parameters: This method accept two parameters as mentioned above and described below: 

  • 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 BigUInt.
  • littleEndian: It 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 returns undefined.

Example 1: In this example, the value set is 1234 at offset 0.


    var buffer = new ArrayBuffer(8);
    var dView = new DataView(buffer);
    dView.setBigUint64(0, 1234n);



Example 2: In this example, the value set is 12345678 at offset 6.


    // Creating an ArrayBuffer with a size in bytes
    const buffer = new ArrayBuffer(32);
    // Setting constant value
    const val = 12345678n;
    const dView = new DataView(buffer);
    dView.setBigUint64(6, val);



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!