let x = Math.floor(1.6);
Try it Yourself »
let a = Math.floor(0.60);
let b = Math.floor(0.40);
let c = Math.floor(5);
let d = Math.floor(5.1);
let e = Math.floor(-5.1);
let f = Math.floor(-5.9);
Try it Yourself »
The Math.floor()
method rounds a number DOWN to the nearest integer.
Math.floor(
x)
Parameter | Description |
x | Required. A number. |
Type | Description |
Number | The nearest integer to the number, rounding DOWN. |
Math.floor()
is an ECMAScript1 (ES1) feature.
ES1 (JavaScript 1997) is fully supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!