Prev Demo
JavaScript
>
Precision
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <h1>Formating into particular specified length</h1> <p>Click the below button to format into 3 digit specified length</p> <input type="button" value="Format" onclick="Function()" /> <p id="myId"></p> <script> function Function() { var A = 1.74562; var R = A.toPrecision(3); document.getElementById("myId").innerHTML = R; } </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output