
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
DataView getFloat64 Function in JavaScript
The getFloat64() function of the DataView gets and returns a signed 64-bit floating point number at the specified position.
Syntax
Its syntax is as follows
dataView.getFloat64();
Example
Try the following example.
<html> <head> <title>JavaScript Example</title> </head> <body> <script type="text/javascript"> var arrayBuffer = new ArrayBuffer(20); var dataView = new DataView(arrayBuffer); dataView.setFloat64(1, 654.44); document.write(dataView.getFloat64(1)); </script> </body> </html>
Output
654.44
Example
To this function, in addition to floating point values you can also pass Math functions.
<html> <head> <title>JavaScript Example</title> </head> <body> <script type="text/javascript"> var arrayBuffer = new ArrayBuffer(20); var dataView = new DataView(arrayBuffer); dataView.setFloat64(1, Math.LOG2E); document.write(dataView.getFloat64(1)); </script> </body> </html>
Output
1.4426950408889634
Example
If nothing is stored in the dataview and if you still, try to get data, this function will return NaN.
<html> <head> <title>JavaScript Example</title> </head> <body> <script type="text/javascript"> var arrayBuffer = new ArrayBuffer(20); var dataView = new DataView(arrayBuffer); dataView.setFloat64(1); document.write(dataView.getFloat64(1)); </script> </body> </html>
Output
NaN
Advertisements