promises ES6 probleme
hi everyone, how do you doing Please I have some issues here when I exec the code below can someone tell me what is wrong !!! ? I just try to learn promises in ES6 the result of this code is undefined and I don't know why let variable = true; function Calculate(Number1, Number2){ return new Promise(function(resolve, reject){ setTimeout(function(){ const some = Number1 + Number2; if(variable){ resolve(some); } else { reject('Sorry'); } }, 1500) }) } function promptAlert(number){ return new Promise(function(resolve, reject){ setTimeout(function(){ number += 2; resolve(number); }, 1000); }) } Calculate(5,5) .then((some) => { promptAlert(some); }) .then((num) => { alert(num); })