-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMonthSeason.html
More file actions
38 lines (37 loc) · 928 Bytes
/
MonthSeason.html
File metadata and controls
38 lines (37 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<script>
let input;
while (true) {
input = Number(prompt("월을 입력해주세요", ""));
if (!isNaN(input)) {
break;
} else {
alert("유효한 수를 입력해주세요");
}
}
const spring = input >= 3 && input < 6;
const summer = input >= 6 && input < 9;
const fall = input >= 9 && input < 12;
const winter = input == 12 || (input >= 1 && input < 3);
if (spring) {
alert("봄입니다.");
}
if (summer) {
alert("여름입니다.");
}
if (fall) {
alert("가을입니다.");
}
if (winter) {
alert("겨울입니다.");
}
</script>
</body>
</html>