2
How to make a dazed call with Javascript native Promise?
I mean, I would like the sentence below to be executed one after the other and I would like to know when that sequence of Promises is finalized.
var promise;
console.log('iniciando...');
[1, 2, 3, 4, 5].forEach(function (i) {
promise = new Promise(function (resolve) {
setTimeout(function () {
resolve(i);
}, 1000)
});
promise.then(function (value) {
console.log(value);
});
});
console.log('finalizado');
You had to make a veiled advertisement for Bolsonaro, right? Wow, this one has to be genius to understand, I wouldn’t understand if it wasn’t for me that I came up with :D
– Maniero
This question is not duplicated from the other https://answall.com/q/140814/129 ?
– Sergio
@Sergio can hammer :p, now that I have seen that they are similar
– Wallace Maxters