Parameters: It has the parameter byteOffset which is offset in a byte and it says where to read the data from the beginning(start) of the view.
Return value: It returns a 16-bit signed integer value.
Below are examples of the dataView.getInt16() Method.
Example 1: In this example, we will see the basic use of dataView.getInt16() Method.
Example 2: Here as it can be seen that this function does not take float value when this float value is given to this function then it converts that value to integer value.
Example 3: Here as it can be seen that this function does not take float value when this float value is given to this function then it converts that value to integer value.
Example 4: When there is no data to be stored, then it returns NaN i.e, not a number.
- 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