JavaScript floor() Method

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








googletag.cmd.push(function() googletag.display('div-gpt-ad-1422003450156-2'); );



JavaScript floor() Method


❮ JavaScript Math Object



Example


Round a number downward to its nearest integer:



Math.floor(1.6);

<!--

The output of the code above will be:



1
-->
Try it Yourself »

More "Try it Yourself" examples below.



Definition and Usage


The floor() method rounds a number DOWNWARDS to the nearest integer, and
returns the result.


If the passed argument is an integer, the value will not be rounded.



Browser Support














Method
floor() Yes Yes Yes Yes Yes

Syntax



Math.floor(x)

Parameter Values





Parameter Description
x Required. The number you want to round






googletag.cmd.push(function() googletag.display('div-gpt-ad-1493883843099-0'); );





Technical Details






Return Value: A Number, representing the nearest integer when rounding downwards
JavaScript Version: ECMAScript 1

More Examples




Example


Use the floor() method on different numbers:



var a = Math.floor(0.60);

var b = Math.floor(0.40);

var c = Math.floor(5);

var d = Math.floor(5.1);

var e = Math.floor(-5.1);

var f = Math.floor(-5.9);

<!--

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



0

0

5

5

-6

-6
-->
Try it Yourself »



❮ JavaScript Math Object

Popular posts from this blog

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

Edmonton

Crossroads (UK TV series)