Docly Developers
Function Updated 17 Oct 2026

Math.round(value)

Rounds a number to the closest whole number. A value exactly halfway is rounded up (towards +∞), as in standard JavaScript: 5.5 gives 6 and -5.5 gives -5. To round to decimals, use Math.round(x * 100) / 100, or x.toFixed(2) for display.

Parameters

valuenumberrequired

Value to round.

Returns

A rounded number.

Example

Mixed HTML (or any text file) with inline JavaScript between hash signs.
// expected output: 1
#Math.round(0.9)# 

// expected output: 6 6 5
#Math.round(5.95)# #Math.round(5.5)# #Math.round(5.05)#

// expected output: -5 -5 -6
#Math.round(-5.05)# #Math.round(-5.5)# #Math.round(-5.95)#