MATH(算数)的方法

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(算数)的方法)