Joined June 2017
·
16967604

dillon-bostwick

Software Engineer
Software Engineer
·
·

One will step through each iteration synchronously; the other will run each function as separate in the event queue:

For example:
for (let i = 0; i < arr.length; i++) { setTimeout(() => { console.log(arr[i]); }, 100); }
will give a different result than
arr.forEach((ele) => { setTimeout(() => { console.log(ele); }; };

Achievements
1 Karma
0 Total ProTip Views