Tutorialsplane

Vue.js round to two decimal places


We can use toFixed() method to round decimal numbers to two places. Here in this tutorial, we are going to explain how you can use this method to format a decimal number to two decimal places. You can also use our online editor to edit and run the code online.


Vue.js round to two decimal places – VueJs JavaScript Example

You can format decimal number to two decimal places simply as below-

Example:

<div id="app">	
	<p>Decimal Number = {{myNumber}}</p>
	<p>Result = {{formattedNumber}}</p>
	<button>Click Me</button>
</div>
    

Try it »

Output of above example-