let arr = [1, 2, 3, 4, 5];
async function uploadMoreFilesFn() {
for (let i = 0; i < arr.length; i++) { await uploadFileFn(arr[i]); } }
function uploadFileFn(item) { return new Promise((res) => { setTimeout(() => { console.log(item); res(); }, 1000); }); }
async function formSubmitFn() { await uploadMoreFilesFn(); setTimeout(() => { console.log("成功;"); }, 4000); }
fn2();
|