About 52 results
Open links in new tab
  1. function - How do JavaScript closures work? - Stack Overflow

    Sep 21, 2008 · How would you explain JavaScript closures to someone with a knowledge of the concepts they consist of (for example functions, variables and the like), but does not understand …

  2. What is a practical use for a closure in JavaScript?

    Apr 28, 2010 · But the callback function in the setTimeout is also a closure; it might be considered "a practical use" since you could access some other local variables from the callback. When I was …

  3. What underlies the `var self = this` JavaScript idiom?

    25 As others have explained, var self = this; allows code in a closure to refer back to the parent scope. However, it's now 2018 and ES6 is widely supported by all major web browsers. The var self = this; …

  4. Closure memory leak of unused variables - Stack Overflow

    This basically includes all free variables the function could access (from what I understood of lostechies, javascript closures explained). Here the first issue arises: this should mean all those variables can be …

  5. functional programming - What is a 'closure'? - Stack Overflow

    Aug 31, 2008 · Now you should understand closures and how they behave, which is a fundamental part of JavaScript. Currying Oh, and you also learned what currying is about: You use functions …

  6. Understanding closure in Javascript - Stack Overflow

    This makes your Javascript methods closer to a pure function, that is, one that returns the same value for the same given arguments. Without using closures, your functions will be like Swiss cheese, they …

  7. closures - What is the purpose of a self executing function in ...

    Attention 2: What do you additionally have to know about functions in Javascript is that the inner functions get access to the parameters and variables of the functions, they are defined within.

  8. What is the difference between a 'closure' and a 'lambda'?

    They often call "closures" what are supposed to be just lambdas. Or they call "closures" a particular technique they used to implement lexical scoping, that is, the fact that a function can access the …

  9. javascript - variable calling function and calling function directly ...

    Oct 31, 2019 · Thanks for explaining in advance. 4/Nov: @DavidFleeman: Am I correct in my understand to first question (I read all 3 links, plus JavaScript Closures 101: What is a closure?, I …

  10. Scope Chain in Javascript - Stack Overflow

    Sep 27, 2009 · To understand the scope chain you must know how closures work. A closure is formed when you nest functions, inner functions can refer to the variables present in their outer enclosing …