Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
#15 JavaScript Tutorial | Scope of Variables | Global vs Local
Play lesson

JavaScript Tutorial for Beginners - #15 JavaScript Tutorial | Scope of Variables | Global vs Local

5.0 (3)
31 learners

What you'll learn

This course includes

  • 9.3 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

Scope determines the accessibility (visibility) of variables. In JavaScript there are two types of scope: Local scope Global scope JavaScript has function scope: Each function creates a new scope. Scope determines the accessibility (visibility) of these variables. Variables defined inside a function are not accessible (visible) from outside the function. Local JavaScript Variables Variables declared within a JavaScript function, become LOCAL to the function. Local variables have Function scope: They can only be accessed from within the function. Since local variables are only recognized inside their functions, variables with the same name can be used in different functions. Local variables are created when a function starts, and deleted when the function is completed. Global JavaScript Variables A variable declared outside a function, becomes GLOBAL. A global variable has global scope: All scripts and functions on a web page can access it. For Program code, info & more resources checkout this article - https://simplesnippets.tech/scope-of-variables-in-javascript/ Strict mode of browser - https://www.w3schools.com/js/js_strict.asp Video by - Tanmay Sakpal Simple Snippets Channel link - https://www.youtube.com/simplesnippets

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere