I was reading airbnb javascript guide. There is a particular statement, that says:
Don’t use iterators. Prefer JavaScript’s higher-order functions ins
The below is a list of advantages I see between the two.
forEach, you need to change which stack-entry you're in to see variables not accessed within the loop function)break or continue directly, instead of needing to use the some function and doing return true, which reduces readability. (can be emulated)await within the loop, with the async/await context preserved. (can be emulated)map and filter, so it's easier to convert between the two.break, continue, return, and even async/await)for-of is 5 characters more if using const -- 3 if using let/var)