这个作业属于哪个课程 | https://edu.cnblogs.com/campus/sdscfz/SF4 |
---|---|
这个作业的要求在哪里 | https://edu.cnblogs.com/campus/sdscfz/SF4/homework/12960 |
这个作业的目标 | 第七次作业-数组输出最大值 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=S], initial-scale=1.0">
<title>Document</title>
</head>
<body>
<SCript>
var numbers = [];
for (var i = 1; i <= 5; i++) {
var num = prompt("请输入第" + i + "个数字");
numbers.push(Number(num));
}
var maxNum = Math.max.apply(null, numbers);
alert("最大值为:" + maxNum);
</SCript>
</body>
</html>