Scroll to top

How do you round to 1 decimal place in Javascript (roundup)?


Notice: Undefined variable: string in /home/u665484253/domains/wpcodekit.com/public_html/wp-content/themes/twentytwenty-child/functions.php on line 61

How do you round to 1 decimal place in Javascript (roundup)?

var number = 12.3456789;
var rounded = Math.round( number * 10 ) / 10;
// rounded is 12.3

Get more information

Read More Posts

Leave a Reply

Your email address will not be published.