JavaScript中的Math系列
JavaScript中的Math系列
- Math.sqrt()
let a=Math.sqrt(3);
console.log(a); // 1.7320508075688772
//开根号用的
- Math.floor()
console.log(Math.floor(1.1)); //1
//地板,向下取整
- Math.ceil()
console.log(Math.ceil(1.1)); //2
//天花板,向上取整
这一路,灯火通明