Each Loop - Mura Docs v6

Each Loop

The Mura Scope has an each() method that takes a List, Array, Query or Iterator and a function reference. Each item in collection will be passed into the action function.

Two values are added to the Mura Scope instance within the action method:

  • $.event('each:count')
    The total count of items in the collection argument.
  • $.event('each:index')
    The index of the current item.

Additionally, it the action method returns false, the each loop is exited.