How to wait a Promise inside a forEach loop
问题 I'm using some Promise() functions to fetch some data and I got stuck with this problem on a project. example1 = () => new Promise(function(resolve, reject) { setTimeout(function() { resolve('foo1'); }, 3000); }); example2 = () => new Promise(function(resolve, reject) { setTimeout(function() { resolve('foo2'); }, 3000); }); doStuff = () => { const listExample = ['a','b','c']; let s = ""; listExample.forEach((item,index) => { console.log(item); example1().then(() => { console.log("Fisrt"); s =