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
//天花板,向上取整
posted @ 2022-06-04 15:47  朱在春  阅读(17)  评论(0编辑  收藏  举报