Why does my JavaScript upload script say finished before the uploads finish?
TechnologyMy practice uploader displays “Finished” while some files are still being sent. I used forEach with an async callback and put await inside that callback. A friend suggested adding a fixed pause before showing the message so the demonstration looks right.
MDN says forEach expects a synchronous callback and doesn't wait for promises. MDN's forEach reference
I haven't asked anyone else to rely on the script. Should I replace the loop or change how completion is reported? I want the message to mean the work has finished, rather than that it usually has enough time on my connection.