<html>
<body>
<p>Click the button to display the formatted number.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var num = 0.001658853;
var a = num.toPrecision();
var b = num.toPrecision(2);
var c = num.toPrecision(3);
var d = num.toPrecision(10);
var n = a + "<br>" + b + "<br>" + c + "<br>" + d;
document.getElementById("demo").innerHTML=n;
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_toprecision3 by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:01:31 GMT -->
</html>