This line means the promise can never be released.
loop(0).catch(console.error)
The catch refers to the first promised returned from the loop. That promise "wraps" any subsequent promises that are generated. Every promise in that chain must be kept in order to properly catch the originally returned promise.
In other news, stack exceptions are also Javascript's fault.
6
u/[deleted] Oct 11 '17
This is the expected behavior.
This line means the promise can never be released.
The catch refers to the first promised returned from the loop. That promise "wraps" any subsequent promises that are generated. Every promise in that chain must be kept in order to properly catch the originally returned promise.
In other news, stack exceptions are also Javascript's fault.