// Math的三个去除小数点的方法
1、Math.round() //四舍五入
console.log(Math.round(3.1)); //结果3
console.log(Math.round(3.5)); //结果4
console.log(Math.round(-3.5)); //结果-3
console.log(Math.round(-3.6)); //结果-4/
2、Math.ceil() // 向上取整
//当取值是正数时
Math.ceil(3.1) === Math.ceil(3.9) === 4
//当取值是负数时
Math.ceil(-3.1) === Math.ceil(-3.9) === -3
3、Math.floor() //向下取整
//当取值是正数时
Math.floor(3.1) === Math.floor(3.9) === 3
//当取值是负数时
Math.floor(-3.1) === Math.floor(-3.9) === -4
Math.random() // 随机返回一个0-1之间的小数
// 返回 0-10 之间的任意一个小数
Math.random() * 11
// 返回 15-18 之间的任意一个小数
Math.random() * 4 + 15
// 返回 x-y 之间的任意一个小数
Math.random() * (y - x + 1) + x