Loading... ## 获取圆周率 PI ```javascript console.log( Math.PI ); ``` ## 绝对值 abs() ```javascript console.log(Math.abs(-10)); ``` ## 向上取整 ceil() ```javascript console.log(Math.ceil(-1.3)); ``` ## 向下取整 floor() ```javascript console.log(Math.floor(-1.3)); ``` ## 四舍五入取整 round() ```javascript console.log(Math.round(1.5)); ``` ## 次方 pow() ```javascript console.log(Math.pow(5,3)); ``` ## 查找一组数字最大值 max() ```javascript console.log(Math.max(23,9,6,4,25,78)); ``` ## 查找一组数字最小值 min() ```javascript console.log(Math.min(23,9,6,4,25,78)); ``` ## 获取随机数 random() ```javascript console.log(Math.random()); ``` Last modification:September 4, 2023 © Allow specification reprint Support Appreciate the author AliPayWeChat Like 如果觉得我的文章对你有用,请随意赞赏