3 ms·
Be my guest. Start using this implementation of each. Let me know if you run into any problems. function each(arr,fn,pos) { pos = pos || 0; fn(arr[pos++
by jcampbell1 14y ago
Be my guest. Start using this implementation of each. Let me know if you run into any problems.
function each(arr,fn,pos) {
pos = pos || 0;
fn(arr[pos++])
if(pos < arr.length)
each(arr,fn,pos);
}
Seems like a recipe for a disaster.
- fogus 14y agoI prefer Underscore's implementation of `each`. It doesn't blow the stack. http://underscorejs.org/docs/underscore.html#section-13 http://underscorejs.org/docs/underscore.html#section-13