Invokes the given callback for each item in the given iterable.
Example
declareconstmap: Map<string, MyObject>; Array.from(map.values()).forEach(obj=>obj.doSomething()); // creates a new array unnecessarily forEach(map.values(), obj=>obj.doSomething()); // one-liner but no new array forEach(map.values(), withCounter((obj, i) =>obj.doSomething(i)); // use withCounter for a kind of index
Invokes the given callback for each item in the given iterable.
Example