| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/DataView/setInt16 | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 ..
setInt16() 16- (short) , DataView.
// Create an ArrayBuffer with a size in bytes
const buffer = new ArrayBuffer(16);
const view = new DataView(buffer);
view.setInt16(1, 32767); // Max signed 16-bit integer
console.log(view.getInt16(1));
// Expected output: 32767
dataview.setInt16(byteOffset, value [, littleEndian])
, .
.
, 16-bit little- or big-endian . false undefined, big-endian.
RangeError, byteOffset , .
setInt16var buffer = new ArrayBuffer(8);
var dataview = new DataView(buffer);
dataview.setInt16(1, 3);
dataview.getInt16(1); // 3
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-dataview.prototype.setint16 |
This page was last modified on 28 . 2025 . by MDN contributors.
DataViewgetBigInt64()getBigUint64()getFloat16()getFloat32()getFloat64()getInt8()getInt16()getInt32()getUint8()getUint16()getUint32()setBigInt64()setBigUint64()setFloat16()setFloat32()setFloat64()DataView.prototype.setInt8()DataView.prototype.setInt16()DataView.prototype.setInt32()setUint8()setUint16()setUint32()Object/FunctionObject.prototype.__defineGetter__()Object.prototype.__defineSetter__()Object.prototype.__lookupGetter__()Object.prototype.__lookupSetter__()Object.prototype.hasOwnProperty()Object.prototype.isPrototypeOf()Object.prototype.propertyIsEnumerable()Object.prototype.toLocaleString()Object.prototype.toString()Object.prototype.valueOf()Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |