Easy Tutorial
❮ Prop Audio Audiotracks Prop Style Borderimagerepeat ❯

JavaScript floor() Method

JavaScript Math Object

Example

Returns the largest integer less than or equal to x:

This example will output:


Definition and Usage

The floor() method returns the largest integer less than or equal to x.

If the parameter passed is an integer, the value remains unchanged.


Browser Support

All major browsers support the floor() method.


Syntax

Parameter Values

Parameter Description
x Required. Any numeric value or expression.

Return Value

Type Description
Number The largest integer less than or equal to x.

Technical Details

| JavaScript Version: | 1.0 | | --- | --- |


More Examples

Example

In this example, we will apply floor() to different numbers:

a, b, c, d, e, and f output results:

0
0
5
5
-6
-6

JavaScript Math Object

❮ Prop Audio Audiotracks Prop Style Borderimagerepeat ❯