You have to assign the return value of .then
back to chain
:
chain = chain.then(()=>getProm(i))
.then(Wait)
Now you will basically be doing
chain
.then(()=>getProm(1))
.then(Wait)
.then(()=>getProm(2))
.then(Wait)
.then(()=>getProm(3))
.then(Wait)
// ...
instead of
chain
.then(()=>getProm(1))
.then(Wait)
chain
.then(()=>getProm(2))
.then(Wait)
chain
.then(()=>getProm(3))
.then(Wait)
// ...
You can see that the first one is actually a chain, while the second one is parallel.