Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The setUint16() method of DataView instances takes a number and stores it as a 16-bit unsigned integer in the 2 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.
The offset, in bytes, from the start of the view to store the data in.
valueThe value to set. For how the value is encoded in bytes, see Value encoding and normalization.
littleEndian OptionalIndicates whether the data is stored in little- or big-endian format. If false or undefined, a big-endian value is written.
Thrown if the byteOffset is set such that it would store beyond the end of the view.
| ECMAScript® 2027 Language Specification # sec-dataview.prototype.setuint16 |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jul 10, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.