Home >Web Front-end >JS Tutorial >ToFixed in javascript fixes the number of decimal places. Simple example sharing_javascript skills
[code]
<script> <br>var a=4.2343; <br>alert(a.toFixed(3)); <br></script>
<script><br>var a=4.2343;<br>alert(a.toFixed(3));<br></script>
Execution result:
The toFixed method converts a number into a string with a fixed number of decimal places.