js中的math

it2024-05-13  46

js中的math对象 <script type="text/javascript"> //Math 是js中的一个静态类 //一般常用的都是一些常用方法 //API console.log(Math.PI)//Π console.log(Math.abs(-1)) //取绝对值 console.log(Math.ceil(0.9)) //天花板函数 console.log(Math.floor(0.9)) //地板函数 console.log(Math.round(0.9))//四舍五入 console.log(Math.random(1)) //获取随机数 var arr = [1,2,3] var item = arr.join(); console.log(Math.max(1,2,3)); console.log(Math.min(1,2,3)); </script>
最新回复(0)