![]() The context in which values and expressions are “visible,” or can be referenced. I think with hindsight this is just about the gist of it. Well I’d always thought of it as the variables and functions that are available to you at a specific point in the code. So let’s start at the beginning, what’s scope? Scope Ok, don’t know about you but I’ve still no clue, however this does give us a starting point. In the process I learnt quite a few new things about how JavaScript compiles and runs and why things happen the way they do and I thought I’d share.Ĭlosure then, what’s that? Here’s a definition from the “You Don’t Know JS” book series:Ĭlosure is when a function is able to remember and access its Lexical Scope even when that function is executing outside its Lexical Scope. I’ve been looking into the concept of closure in JavaScript, trying to really understand what it means.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |