Are Javascript closures good or bad for optimisation?
<p>In his Google techtalk regarding JavaScript: The Good Parts, Crockford presents closures as an efficient way of negating the need to redefine objects: <a href="http://www.youtube.com/watch?v=hQVTIJBZook&amp;t=27m14s" rel="nofollow">http://www.youtube.com/watch?v=hQVTIJBZook&amp;t=27m14s</a></p>

<p>This article however, states that closures are a common source of memory leaks: <a href="https://developers.google.com/speed/articles/optimizing-javascript" rel="nofollow">https://developers.google.com/speed/articles/optimizing-javascript</a></p>

<p>Are closures really a source of memory leaks? Would you recommend taking Crockford's advice on this particular pattern?</p>

<p>Here's the function from Crockford's talk:</p>

<pre><code>var digit_name = function() {
    var names = ['zero', 'one','two'];
    return function(n) {
        return names[n];
    };
}();
</code></pre>
