- 1

Bad Promises Tutorial

It's confusing and unhelpful to describe promises as alternative to setTimeout, and then use BOTH in the same example: function asyncFunc(work) { return new Promise(function(resolve, reject) { if (work === "") reject(Error("Nothing")); setTimeout(function() { resolve(work); }, 1000); }); }

25th Apr 2020, 1:44 PM
John Weiss
John Weiss - avatar
2 Antworten
+ 1
Better fetching from an RESTful API Expand the Async series and learn from here : https://code.sololearn.com/WKKkpq0efxai/?ref=app
25th Apr 2020, 1:45 PM
Gordon
Gordon - avatar
0
Where did you find this bad promises tutorial? Promises are not an alternative to setTimeout... but setTimeout is usually used in promises tutorial to simulate async long time operations ^^
25th Apr 2020, 5:10 PM
visph
visph - avatar