<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
alert(Math.random())//(0,1) 返回 0 ~ 1 之间的随机数。
alert(Math.round(2.8)) //把数四舍五入为最接近的整数。
var num=10*Math.random();
num=Math.round(num);
alert(num);
内置对象--拿来即用
alert(Math.pow(2,4))
window.alert(123)
</script>
</body>
</html>