From b118f1a01a99e7f92417ea001edb62306c19227d Mon Sep 17 00:00:00 2001 From: puru-khedre <101047627+puru-khedre@users.noreply.github.com> Date: Wed, 5 Oct 2022 20:49:15 +0530 Subject: [PATCH] Add content on 'scope and function stack' (#2165) adding content of the scope and function stack node in Javascript roadmap. --- .../105-scope-and-function-stack/readme.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/content/roadmaps/106-javascript/content/109-javascript-functions/105-scope-and-function-stack/readme.md b/content/roadmaps/106-javascript/content/109-javascript-functions/105-scope-and-function-stack/readme.md index 332f72563..cab8e9d9a 100644 --- a/content/roadmaps/106-javascript/content/109-javascript-functions/105-scope-and-function-stack/readme.md +++ b/content/roadmaps/106-javascript/content/109-javascript-functions/105-scope-and-function-stack/readme.md @@ -1 +1,17 @@ -# Scope and function stack \ No newline at end of file +# Scope and function stack + +## Scope +A space or environment in which a particular variable or function can be accessed or used. Accessibility of this variable or function depends on where it is defined. + +JavaScript has the following kinds of scopes: +- **Global scope**: The default scope for all code running in script mode. +- **Module scope**: The scope for code running in module mode. +- **Function scope**: The scope created with a function. +- **Block scope**: The scope created with a pair of curly braces (a block). + +## Function Stack (Call stack) +The function stack is how the interpreter keeps track of its place in a script that calls multiple functions, like which function is currently executing and which functions within that function are being called. + +Free Content +Function stack (call stack) - MDN +Kinds of Scope - MDN