Variable scope, closure thumbnail
Variable scope, closure
javascript.info
If a variable is declared inside a code block {...}, it’s only visible inside that block. Visually, let i is outside of {...}. But the for construct is special here: the variable, declared inside it, is considered a part of the block. A function is called “nested” when it is created inside another f
5 Users
0 Comments
72 Highlights
2 Notes

Top Highlights

  • If a variable is declared inside a code block {...}, it’s only visible inside that block.
  • Visually, let i is outside of {...}. But the for construct is special here: the variable, declared inside it, is considered a part of the block.
  • A function is called “nested” when it is created inside another function.
  • The Lexical Environment object consists of two parts:
  • (unlike let, that is unusable till the declaration).

Tags

Closure
filter
Array
Example
javascript

Ready to highlight and find good content?

Glasp is a social web highlighter that people can highlight and organize quotes and thoughts from the web, and access other like-minded people’s learning.