6 ms·
I think that because TCO is all but inevitable in future engines/standards, starting to use functional patterns now for the programming benefits is worthwhile.
by johnpmayer 14y ago
I think that because TCO is all but inevitable in future engines/standards, starting to use functional patterns now for the programming benefits is worthwhile.
- jcampbell1 14y agoBe 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