|
|
|
|
|
by cmwelsh
4968 days ago
|
|
I think we are in complete agreement. Your example is a little prettier however you still have this "unoptimized" line: ;[1,2,3].forEach(function(x) {
If this line is executed more than once, the nested function will be created again and again, wasting memory. However, some people may see my advice here as a micro-optimization. Thus, don't make your code ugly until you identify the real-world bottlenecks. I have updated my code in the grand-parent comment to explain myself a little more clearly (maybe)... |
|