Skip to content

Latest commit

 

History

History
54 lines (44 loc) · 1.54 KB

File metadata and controls

54 lines (44 loc) · 1.54 KB
title ms.custom ms.date ms.prod ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic f1_keywords dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
Math.round Function (JavaScript) | Microsoft Docs
01/18/2017
windows-client-threshold
devlang-javascript
language-reference
round
JavaScript
TypeScript
DHTML
Round method
Math object
51008df3-5d0c-4951-84cb-4f41000db0be
13
mikejo5000
mikejo
ghogen

Math.round Function (JavaScript)

Returns a supplied numeric expression rounded to the nearest integer.

Syntax

  
Math.round(  
number  
)   

Remarks

The required number argument is the value to be rounded to the nearest integer.

For positive numbers, if the decimal portion of number is 0.5 or greater, the return value is equal to the smallest integer greater than number. If the decimal portion is less than 0.5, the return value is the largest integer less than or equal to number.

For negative numbers, if the decimal portion is exactly -0.5, the return value is the smallest integer that is greater than the number.

For example, Math.round(8.5) returns 9, but Math.round(-8.5) returns -8.

Requirements

[!INCLUDEjsv1]

Applies To: Math Object

See Also

Math.random Function