math.floor javascript
返回小于或等于一个给定数字的最大整数。语法 <strong>Math.floor()</strong>Math.floor(<em>x</em>)
一个数字。 参数x返回值 一个表示小于或等于指定数字的最大整数的数字。
由于
是 floor的一个静态方法,你总是应该像这样使用它 Math,而不是作为你创建的一个Math对象的一种方法(Math不是一个构造函数)。 Math.floor()例如:Math.floor(1.6)返回1;
Math.floor(5.1) = 5
Math.floor(-5.1) = -6使用
<code class="language-javascript">Math.floor( 45.95); // 45 Math.floor( 45.05); // 45 Math.floor( 4 ); // 4 Math.floor(-45.05); // -46 Math.floor(-45.95); // -46
Math是javascript的对象,Math 对象方法有:
1、Math.abs(x) :返回数的绝对值;
2、Math.acos(x) :返回数的反余弦值;
3、Math.asin(x) :返回数的反正弦值;
4、Math.ceil(x) :对数进行上舍入;
5、Math.max(x,y) :返回 x 和 y 中的最高值;
6、Math.min(x,y) :返回 x 和 y 中的最低值
