-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise-4.js
More file actions
49 lines (47 loc) · 1.01 KB
/
Exercise-4.js
File metadata and controls
49 lines (47 loc) · 1.01 KB
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
39
40
41
42
43
44
45
46
47
48
49
var tanggal = 1
var bulan = 9
var tahun = 1900
if (tanggal <1 || tanggal > 31 || tahun <1900 || tahun >2200 || bulan <1 || bulan >12)
{
console.log('invalid date input');
}
else{
switch (bulan){
case 1:
console.log( tanggal + ' Januari ' +tahun )
break;
case 2:
console.log( tanggal + ' Februari ' +tahun )
break;
case 3:
console.log( tanggal + ' Maret ' +tahun )
break;
case 4:
console.log( tanggal + ' April ' +tahun )
break;
case 5:
console.log( tanggal + ' Mei ' +tahun )
break;
case 6:
console.log( tanggal + ' Juni ' +tahun )
break;
case 7:
console.log( tanggal + ' Juli ' +tahun )
break;
case 8:
console.log( tanggal + ' Agustus ' +tahun )
break;
case 9:
console.log( tanggal + ' September ' +tahun )
break;
case 10:
console.log( tanggal + ' Oktober ' +tahun )
break;
case 11:
console.log( tanggal + ' November ' +tahun )
break;
case 12:
console.log( tanggal + ' Desember ' +tahun )
break;
}
}