JS Math

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<SCRIPT>
alert(Math.min(5,2,3));//取较小的值
alert(Math.max(1,2,3));//取较大的值
alert(Math.abs(-12));//绝对值
alert(Math.floor(1.530));//向下取整
alert(Math.ceil(1.234));//向上取整
alert(Math.round(1.534));//四舍五入
alert(Math.random());//随机数
</SCRIPT>
</head>
<body>

</body>
</html>
posted on 2019-01-09 09:56  猛兽  阅读(156)  评论(0编辑  收藏  举报