-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask2.js
More file actions
29 lines (24 loc) · 736 Bytes
/
Copy pathTask2.js
File metadata and controls
29 lines (24 loc) · 736 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
//Tugas2
// Buat program menggunakan callback function untuk melanjutkan dan menampilkan semua bulan menggunakan method map
const getmonth = (callback) => {
setTimeout(() => {
let error = false;
let month = ['January', 'February', 'March', 'April', 'May', 'July', 'Agustus', 'September', 'October', 'November', 'Desember'];
if (!error) {
callback(null, month)
} else {
callback(new Error('sorry Data Not Found'), [])
}
}, 1000)
}
const month = (massage, month) =>{
if (massage != null){
console.log(massage)
}else {
let result = month;
result.map((item)=>{
console.log(item)
})
}
}
getmonth(month)