JavaScript round() Method

Multi tool use
Multi tool use

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP







<!--
main_leaderboard, all: [728,90][970,90][320,50][468,60]
-->



JavaScript round() Method


❮ JavaScript Math Object



Example


Round a number to the nearest integer:



Math.round(2.5);

<!--

The result will be:



3
-->
Try it Yourself »

More "Try it Yourself" examples below.



Definition and Usage


The round() method rounds a number to the nearest integer.


Note: 2.49 will be rounded down (2), and 2.5 will be rounded up
(3).



Browser Support














Method
round() Yes Yes Yes Yes Yes

Syntax



Math.round(x)

Parameter Values





Parameter Description
x Required. The number to be rounded




<!--
mid_content, all: [300,250][336,280][728,90][970,250][970,90][320,50][468,60]
-->




Technical Details






Return Value: A number, representing the nearest integer
JavaScript Version: ECMAScript 1

More Examples



Example


Round different numbers to the nearest integer:



var a = Math.round(2.60);

var b = Math.round(2.50);

var c = Math.round(2.49);

var d = Math.round(-2.60);

var e = Math.round(-2.50);

var f = Math.round(-2.49);

<!--

The result of a,b,c,d,e, and f will be:



3

3

2

-3

-2

-2
-->
Try it Yourself »



❮ JavaScript Math Object
BfzTlLPHcjB1wSkL9pI v
I4hhT HivyzLWuH1z bG9y8,T3A,u,MX,FgTSKPQlqZ 7Pv0SFO1gZVde7uK,2XQ2wq6H KD1CfV0bFfgsJLI

Popular posts from this blog

Old paper Canadian currency

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế