-
Notifications
You must be signed in to change notification settings - Fork 0
/
exercise-14.js
36 lines (31 loc) · 1008 Bytes
/
exercise-14.js
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
var input = ['0001', 'Roman Alamsyah ', 'Bandar Lampung', '21/05/1989', 'Membaca'];
function convertMonth(month) {
switch(month) {
case 01: { return 'Januari'; }
case 02: { return 'Februari'; }
case 03: { return 'Maret'; }
case 04: { return 'April'; }
case 05: { return 'Mei'; }
case 06: { return 'Juni'; }
case 07: { return 'Juli'; }
case 08: { return 'Agustus'; }
case 09: { return 'September'; }
case 10: { return 'Oktober'; }
case 11: { return 'Nopember'; }
case 12: { return 'Desember'; }
}
}
function dataHandling2(input_) {
input_.splice(0, 6, input_[0], input_[1] + 'Elsharawy', 'Provinsi ' + input_[2], input_[3], 'Pria', 'SMA Internasional Metro');
var date = input_[3].split('/').map(function (item) {
return parseInt(item, 10);
})
var joinDate = date.join('-');
var sortDate = date.sort();
console.log(input_);
console.log(convertMonth(date[1]));
console.log(sortDate);
console.log(joinDate);
console.log(input_[1].slice(0, 15));
}
dataHandling2(input);