Created
January 4, 2017 12:54
-
-
Save bepitulaz/42d2f5d34939371b7e92da82c9573620 to your computer and use it in GitHub Desktop.
Callback vs Promise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
/** | |
Tiga operasi menghapus file di bawah ini, walaupun disusun berurutan | |
tetapi belum tentu selesainya berurutan dari operasi 1 sampai operasi 3. | |
*/ | |
// Operasi 1 | |
fs.unlink('/file-one', function(err) { | |
console.log('file one is deleted'); | |
}); | |
// Operasi 2 | |
fs.unlink('/file-two', function(err) { | |
console.log('file two is deleted'); | |
}); | |
// Operasi 3 | |
fs.unlink('/file-three', function(err) { | |
console.log('file three is deleted'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment