RUVIDEO
Поделитесь видео 🙏

14 Javascript Variable scoping - JavaScript Tutorial 2018

Full #Javascript #tutorial for #beginners : http://bizanosa.com/js

14 Javascript Variable scoping - JavaScript for Beginners.

This is a Javascript tutorial from scratch for any beginner. Use the above link to watch the full JS video tutorial..

Next Video: https://youtu.be/mwkOGtl4FUU
Previous Video: https://youtu.be/d-wlzviLxes

Hey, and welcome back.

So in the last video we said that we're going to look at variable hoisting.

But before that, we need to look at variable scoping.

So scoping basically defines how a variable is usable.

Is it a local variable or a global variable.

A global variable is accessible in the entire document.

Any part of the document that you go to, and by document I mean a ‘.js’ file that has lots of JavaScript code.

So that's what I'm calling and referring to as a document in this case.

So you may find that a document may have functions and may also have something like an ‘if’ block.

So in this case, this is an ‘if’ block.

So this ‘if’ block has its scope.

So the scope of this ‘if’ block ends, it ends where this final closing bracket ends.

So, in a normal programming, in other programming languages, if this was the case, this variable would be what is called a local variable.

It would only be accessible within this block.

That makes it a local variable.

But if it was defined outside of this block and outside of any function, it would be a global variable that is accessible by any other function or by any other ‘if’ block or by any other thing that wants to use that variable.

As long as it is not defined within a function or within an ‘if’ block or any other kind of block like ‘else’ block, it is a global variable.

So JavaScript as you know is a very loose language.

And if you use the ‘var’ keyword, this variable will, will be accessible from outside of this block.

So the scope of this to some extent is a global variable.

If this was something like Java and this was a class, this variable would not be accessible from outside of this block.

In Java we have public variables, protected variables and private variables.

So unless it was declared as a public variable, it would not be able, it will not be accessible from outside of this block.

So I hope you do understand what scoping is.

And in the next video, let's look at an example of this.

Let's look at an example of this and see how variables are accessible outside of the block.


Javascript,web design, js,js tutorial,javascript tutorial, js guide,javascript guide,front end web design,frontend javascript,

javascript video tutorials, JavaScript for Beginners



GET SOCIAL WITH ME:
FACEBOOK: https://www.facebook.com/rwahowa/
INSTAGRAM: https://www.instagram.com/rwahowa/
TWITTER: https://twitter.com/rwahowa/
VIMEO: https://vimeo.com/bizanosa/
WEBSITE : http://rwahowa.com

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «14 Javascript Variable scoping - JavaScript Tutorial 2018», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.