- Variables created without the keyword var , are always global, even if they are created inside a function
- A closure is an inner function that has access to the outer (enclosing) function’s variables—scope chain. The closure has three scope chains: it has access to its own scope (variables defined between its curly brackets), it has access to the outer function’s variables, and it has access to the global variables. A closure in JavaScript is like keeping a copy of all the local variables, just as they were when a function exited.
0 comments:
Post a Comment