Below is the example of the dataView.getUint16()() Method.
The dataView.getUint16() is an inbuilt function in dataView which is used to get an unsigned 16-bit integer at the specified location i.e, at byte offset from the start of the dataView.
Parameters: It has parameter byteOffset which is offset in a byte and it says from the start of the view were to read the data.
Return value: It returns unsigned 16-bit integer.
Input: dataview1.setUint16(1, 56); document.write(dataview1.getUint16(1)); Output: 56
Input: dataview1.setUint16(1, Math.PI); document.write(dataview1.getUint16(1)); Output: 3
This function convert the float value of PI from 3.14 to 3
When there is no data to be stored, then it returns zero (0).
- Google Chrome 9 and above
- Edge 12 and above
- Firefox 15 and above
- Internet Explorer 10 and above
- Opera 12.1 and above
- Safari 5.1 and above