Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From <a href="http://www.javascriptkit.com/javatutors/closures.shtml" rel="nofollow noreferrer">JavaScript Closures</a></p> <p>Two one-sentence summaries:</p> <blockquote> <p>A closure is the local variables for a function - kept alive after the function has returned, or</p> <p>A closure is a stack-frame which is not deallocated when the function returns. (as if a 'stack-frame' were malloc'ed instead of being on the stack!)</p> </blockquote> <p>A very good article on closures</p> <p><a href="http://www.jibbering.com/faq/faq_notes/closures.html" rel="nofollow noreferrer">Javascript Closures</a></p> <blockquote> <p>A "closure" is an expression (typically a function) that can have free variables together with an environment that binds those variables (that "closes" the expression).</p> <p>The simple explanation of a Closure is that ECMAScript allows inner functions; function definitions and function expressions that are inside the function bodies of other functions. And that those inner functions are allowed access to all of the local variables, parameters and declared inner functions within their outer function(s). A closure is formed when one of those inner functions is made accessible outside of the function in which it was contained, so that it may be executed after the outer function has returned. At which point it still has access to the local variables, parameters and inner function declarations of its outer function. Those local variables, parameter and function declarations (initially) have the values that they had when the outer function returned and may be interacted with by the inner function.</p> </blockquote> <p>A good example over here</p> <p><a href="http://devlicio.us/blogs/sergio_pereira/archive/2009/02/23/javascript-time-to-grok-closures.aspx" rel="nofollow noreferrer">JavaScript, time to grok closures</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload