I am having trouble with promises ,
or who done what to whom and when ?
Pls , what is the order of execution with the following code:
const wait = time => new Promise((resolve) => setTImeout(resolve, time)) ; wait(3000).then(() => console.log('Hello!')) ;
Is this correct
- const wait = time
- setTImeout(resolve, time)
When did 3000 get plugged into time ?
Also any chance you could convert code into (es4) type callback code . Maybe then I could understand it better .