JavaScript Tutorial in Hindi #32: Local and Global Scope in JavaScript in Hindi | JavaScript Scope
Вставка
- Опубліковано 31 тра 2018
- Welcome all, we will see Local and Global Scope in JavaScript in Hindi local variable and global variable in javascript.scope in javascript in Hindi.
Scope determines the accessibility (visibility) of variables.
JavaScript Function Scope
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 local scope: They can only be accessed 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.
JavaScript Variables
In JavaScript, objects and functions are also variables.
Scope determines the accessibility of variables, objects, and functions from different parts of the code.
Automatically Global
If you assign a value to a variable that has not been declared, it will automatically become a GLOBAL variable.
The Lifetime of JavaScript Variables
The lifetime of a JavaScript variable starts when it is declared.
Local variables are deleted when the function is completed.
In a web browser, global variables are deleted when you close the browser window (or tab), but remain available to new pages loaded into the same window.
Guys, Please support my channel by SUBSCRIBE to my channel and share my videos in your Social Network TimeLines.
Don't Forget to Follow me on all Social Network,
Instagram Link: / vinodthapa55
Facebook Link: / vinodthapa55
Twitter Link: / vb55thapa
Facebook ThapaTechnical Page Link: / vinodbahadurthapa
Thanx bro... Video is very helpful
Thanks for awesome JavaScript tutorial
5:30 ki hassi sahi thi yrr
Super smart Bhai
the playlist need to be organised. Very clumsy.
sir plz upload angular 5 full tutorial
Please add this tutorial in playlist javascript ..after 31?
tutorial good but starting sound it's not good
Bhai line no. 42 me realname nhi chala hai balki jo function me line no. 47 hai vo realname chala hai.
Please watch again from 11:30.