3 ms·
I can get where you're going with this, but as someone who uses underscore everyday I have to say in this particular case I don't agree with you. Underscore a
by mikeryan 14y ago
I can get where you're going with this, but as someone who uses underscore everyday I have to say in this particular case I don't agree with you.
Underscore as a production library is 4kb. The functions are terse, and its extremely easy to understand what they're doing - nothing is generally hidden (this example is pretty easy to understand, yet one of the most "complex" uses of underscore I've seen).
At the end of the day on a production javascript app of multiple thousand lines of JS, it likely actually saves me bytes over the wire from not having to write "for(var x = 0...." every time I want to iterate through something or filter an array or find if an array includes something etc (There's around 70 bytes removed in this single example).
- thinkingisfun 14y agoWell, of course it matters how often you do it. I would not do it in loops, or often called event handlers, such as scrolling. If you do it once on page load, sure, it hardly matters. But if you do it a lot in your code, that just means you can easily copy and paste it from a nearby place? At least that's what I often end up doing.