“The iterator is bound to the context object.”

blueridetodown

New Member
The Underscore.js documentation says:\[quote\] _.each(list, iterator, [context]) Iterates over a list of elements, yielding each in turn to an iterator function. The iterator is bound to the context object, if one is passed. Each invocation of iterator is called with three arguments: (element, index, list). If list is a JavaScript object, iterator's arguments will be (value, key, list). Delegates to the native forEach function if it exists.\[/quote\]\[code\]_.each([1, 2, 3], alert);=> alerts each number in turn..._.each({one : 1, two : 2, three : 3}, alert);=> alerts each number value in turn...\[/code\]What does the bolded text above mean? Can someone provide an example that would explain it?
 
Back
Top