0

This will log 5 and 1:

console.log(5)
    var promise1 = new Promise((resolve,reject)=>{resolve(1)});
    promise1.then(info=>{console.log(info)});

This will log 5 only:

console.log(5)
    var promise1 = new Promise((resolve,reject)=>{return 1});
    promise1.then(info=>{console.log(info)});

Why doesn't the first case log 1? I thought returning a value to the promise was same as returning value to it?

Hisham Hijjawi
  • 1,803
  • 2
  • 17
  • 27

0 Answers0