function asyncFunction() {
return new Promise(function(resolve, reject) {
console.log('Async Hellow World');
resolve('X');
});
}
asyncFunction().then(function (data) {
console.log('Your request was approved, and the variable is ' + data);
}, function(data) {
console.log('The server reject your request');
}).catch(function(err) {
console.log('Error: ' + err);
});
/*
* Main Func: success | resolve ; fail | reject == user defined ???
* Callback: success | then ; fail | catch
*/