<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
// Math.pow(); 幂
// Math.sqrt(); 开方
// Math.ceil(); 向上取整
// Math.floor(); 向下取整
// Math.round(); 四舍五入
// Math.max() 参数列最大值
// Math.min(); 参数列最小值
var a = Math.round(3.6457);
console.log(a); //4
var b = 3.75568;
console.log(Math.round(b * 100) / 100); //3.76
var c = Math.max(4, 5, 67, 9, 4, 10);
console.log(c); //67
var d = Math.min(4, 5, 67, 9, 4, 10);
console.log(d); //4
// 求得数组的最大值。
var ar = [44, 55, 66, 77, 1, 6, 11];
console.log(Math.max.apply(null, ar)); //77
//求随机数。
console.log(Math.random());
console.log(Math.random());
console.log(Math.random());
console.log(Math.random());
console.log(Math.random());
// 求随机数 [3,10];
//console.log(parseInt(Math.random() * (b - a + 1)) + 3);
console.log(parseInt(Math.random() * (10 - 3 + 1)) + 3);
</script>
</body>
</html>