Scope in JavaScript Explained in 5 Minutes

preview_player
Показать описание
Scope in JavaScript is an incredibly important concept to understand. Without having a grasp on it, even the most basic programs become close to impossible to write.

Scope refers to where your variables are accessible form within your program. JavaScript is lexically scoped, meaning where you write your variables is what determines their accessibility.

Scope in JavaScript is function (and sometimes block) scoped. This meaning that functions create their own variable scope, and the variables within them get scoped to that function.

Overall, there is one main important concept to understand: the scope chain. Inner scopes have access their outer scopes' variables. Outer scopes do NOT have access to their inner scopes' variables. In other words, your program will climb up the scope chain to search for variables, but it will not climb down it.
Рекомендации по теме
Комментарии
Автор

I like how your channel covers variable topics about the inner and outer functions of web development. Its nice to have a channel to reference all these points globally.

thestuffoflegenddanielloer
Автор

In the scope of things, I would say this tutorial was functional.

thestuffoflegenddanielloer
Автор

this channel has some very good video content.. i cant understand why did the author stopped posting videos ????

themynamesb
Автор

You should not teach Closures when you make a "beginer variable scope video".

Zen-lzhc
join shbcf.ru