Phaser API Documentation

each(callback, [context], [args])


Passes all Game Objects in this Container to the given callback.

A copy of the Container is made before passing each entry to your callback. This protects against the callback itself modifying the Container.

If you know for sure that the callback will not change the size of this Container then you can use the more performant Container.iterate method instead.


name type arguments description
callback function

The function to call.

context object <optional>

Value to use as this when executing callback.

args * <optional>

Additional arguments that will be passed to the callback, after the child.


This Container instance.

Since: 3.4.0