UNB/ CS/ David Bremner/ teaching/ cs2613/ books/ mdn/ Reference/ Global Objects/ DataView/ DataView.prototype.setInt32()

The setInt32() method of DataView instances takes a number and stores it as a 32-bit signed integer in the 4 bytes starting at the specified byte offset of this DataView. There is no alignment constraint; multi-byte values may be stored at any offset within bounds.

Syntax

setInt32(byteOffset, value)
setInt32(byteOffset, value, littleEndian)

Parameters

Return value

undefined.

Exceptions

Examples

Using setInt32()

const buffer = new ArrayBuffer(10);
const dataview = new DataView(buffer);
dataview.setInt32(0, 3);
dataview.getInt32(1); // 768

Specifications

Browser compatibility

See also