closures.js

@@ -1,12 +1,721 @@
-closures.js
+// - What is a closure?%0A%0A// A closure is an inner function that has access to the outer (enclosing) function%E2%80%99s variables%E2%80%94scope chain.%0A// The closure has three scope chains:%0A//     it has access to its own scope (variables defined between its curly brackets),%0A//     it has access to the outer function%E2%80%99s variables,%0A//     and it has access to the global variables.%0A%0A// The inner function has access not only to the outer function%E2%80%99s variables, but also to the outer function%E2%80%99s parameters.%0A// Note that the inner function cannot call the outer function%E2%80%99s arguments object,%0A// however, even though it can call the outer function%E2%80%99s parameters directly.%0A%0A// You create a closure by adding a function inside another function.%0A
 %0A

add desc