3 ms·
thanks for the suggestions. I tend to avoid forEach because of the memory overhead (adds function calls where not really necessary). I guess I'm old school, but
by alistproducer2 10y ago
thanks for the suggestions. I tend to avoid forEach because of the memory overhead (adds function calls where not really necessary). I guess I'm old school, but never got around to using includes. It's been on my radar for a while. I've always tried to write code that is as portable as possible, even though now, with evergreen browsers in the lead, it doesn't really matter as much.
- nailer 10y agoYeah, .forEach() is a new scope. But the better readability is worth the minor performance impact for everything but the most performance-intensive code.
- drenvuk 10y agoIt's that kind of thinking that gets us really slow software.
- nailer 10y ago"premature optimization is the root of all evil" - Don Knuth Also old-style for loops in JS fall victim to the last entry effect since people often use them to set up event handlers and wonder why they don't work.