math对象

console.log(Math.ceil(1.1));//上舍入 (取大数)

console.log(Math.floor(1.9));//下舍入 (取小数)

console.log(Math.round(2.5));//四舍五入

//产生 x - y 的随机数,包括x 但不包括y

//Math.random()*(y-x)+x;

//产生 从x-y的随机数,包括x也包括y

//=Math.random(y-x+1)+x

你可能感兴趣的:(math对象)