--- title: DataView.prototype.getUint16() slug: Web/JavaScript/Reference/Global_Objects/DataView/getUint16 tags: - 类型化 - 类型化数组 translation_of: Web/JavaScript/Reference/Global_Objects/DataView/getUint16 ---
getUint16()
方法
从
DataView
相对于起始位置偏移 n 个字节处开始,获取一个16-bit数(无符号短整型,2个字节).
dataview.getUint16(byteOffset [, littleEndian])
var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.getUint16(1); // 0
Specification | Status | Comment |
---|---|---|
{{SpecName('Typed Array')}} | {{Spec2('Typed Array')}} | Superseded by ECMAScript 6. |
{{SpecName('ES6', '#sec-dataview.prototype.getuint16', 'DataView.prototype.getUint16')}} | {{Spec2('ES6')}} | Initial definition in an ECMA standard. |
{{SpecName('ESDraft', '#sec-dataview.prototype.getuint16', 'DataView.prototype.getUint16')}} | {{Spec2('ESDraft')}} |
{{Compat("javascript.builtins.DataView.getUint16")}}