美文网首页
MATH(算数)的方法

MATH(算数)的方法

作者: 撸码者 | 来源:发表于2017-12-28 10:39 被阅读4次

1.round(参数):Math.round(0.60)   四舍五入=1;Math.round(-0.60)  四舍五入=-1;

2.random():返回 0 ~ 1 之间的随机数;

3.max(参数1,参数2):返回两者的最大者;

4.min(参数1,参数2):返回两者的最小者;

5.abs(参数):返回数的绝对值。

6.ceil(参数):向上取舍。

7.floor(参数):向下取舍。

8.toSource():返回对象的各个属性值。

function employee(name,job,born){this.name=name;this.job=job;this.born=born;}var bill=new employee("Bill Gates","Engineer",1985);document.write(bill.toSource());function employee(name,job,born){this.name=name;this.job=job;this.born=born;}var bill=new employee("Bill Gates","Engineer",1985);document.write(bill.toSource());

function employee(name,job,born){this.name=name;this.job=job;this.born=born;}var bill=new employee("Bill Gates","Engineer",1985);document.write(bill.toSource());function employee(name,job,born){this.name=name;this.job=job;this.born=born;}var bill=new employee("Bill Gates","Engineer",1985);document.write(bill.toSource());

相关文章

网友评论

      本文标题:MATH(算数)的方法

      本文链接:https://www.haomeiwen.com/subject/pokmgxtx.html