What is context in _.each(list, iterator, [context])?
I am new to underscore.js. What is the purpose of [context] in _.each() ? How should it be used? The context parameter just sets the value of this in the iterator function. var someOtherArray = ["name","patrick","d","w"]; _.each([1, 2, 3], function(num) { // In here, "this" refers to the same Array as "someOtherArray" alert( this[num] ); // num is the value from the array being iterated // so this[num] gets the item at the "num" index of // someOtherArray. }, someOtherArray); Working Example: http://jsfiddle.net/a6Rx4/ It uses the number from each member of the Array being iterated to get the