Math类是一个构造函数
Math.ceil 上舍入,向上取整。
console.log(Math.ceil(1.4)); // 2
Math.floor 向下取整
console.log(Math.floor(1.4)); // 1
Math.round 四舍五入取整
随机数
生成100个10以内的随机数
for(i = 0;i<=100;i++){
console.log(Math.round(Math.random()*10));
}
具体参考W3School手册