There's javascript's foreach, which also gives an optional index. Indices are important to uniquely identify members in case you want non-uniform behavior: for example, "give 3 kinds of candy alternatingly"; element variables in turn are important for behavior that's a function of the member, say when you want to "give candy in proportion to their age".