5 ms·
Nope, the shared scope would obligate me to create a function with binded params for each iteration so "i" is not the last value (e.g. path.length) in every cal
by jQueryIsAwesome 13y ago
Nope, the shared scope would obligate me to create a function with binded params for each iteration so "i" is not the last value (e.g. path.length) in every call. Examples: http://stackoverflow.com/questions/1451009/javascript-infamous-loop-problem http://stackoverflow.com/questions/1451009/javascript-infamo...
- Jare 13y agoExactly, one of the advantages of using a good abstraction like forEach() is that it prevents you from making that kind of mistake. On the other hand, it can be more costly in cases where you don't need the closure. All abstractions by definition have some tradeoffs, some visible or hidden complexity, and some extra knowledge. Promises are no different.
- jQueryIsAwesome 13y agoI see no benefits in promises, zero, none.