1. 콜백 패턴 (Call Back Pattern)
var callBack = function(text, done){
console.log('callBackkFunc', text);
done(text + ' done');
}
callBack('test Text', function(res){
console.log('Success', res);
})

2. 프라미스 패턴 (Promise Pattern)
var callBack = function(text){
return new Promise(function(resolve, reject) {
console.log('callBackkFunc', text);
resolve(text + ' done');
})
}
callBack('test Text').then(function(res){
console.log('Success', res);
}).catch(function(error){
console.log('error', error);
})

참조: https://geundung.dev/53