🔸return()
give iterator a chance to perform cleanup actions.
JS⟩ iteration ⟩ iterator ⟩ return()
this method is invoked automatically when the iteration is stopped prematurel, it is where you can perform cleanup actions.
the return() method must return an iteration result object:
properties of the returned object are ignored
it is an error to return a non-object value
Last updated