Learn JavaScript VARIABLE SCOPE in 5 minutes! 🏠

  Рет қаралды 25,058

Bro Code

Bro Code

Күн бұрын

Пікірлер: 27
@BroCodez
@BroCodez Жыл бұрын
// variable scope = where a variable is recognized // and accessible (local vs global) let x = 3; // global scope function1(); function function1(){ let x = 1; // local scope console.log(x); } function function2(){ let x = 2; // local scope console.log(x); }
@billionairem4fia
@billionairem4fia Жыл бұрын
3:27 is a global scope
@LizyAd
@LizyAd 9 ай бұрын
This has to be the best explanation for scoping on youtube. I love the examples!
@goodness776
@goodness776 4 ай бұрын
Best incremental teaching! You are a gifted teacher.
@emagenation6409
@emagenation6409 9 ай бұрын
This is the best and clearest explanation I can get on youtube!! Your reference of neighbour house makes so much sense to me. Thank you, you’re the best teacher bro🙏
@GrayShark09
@GrayShark09 9 ай бұрын
Yes! Bro Code is a master explainer! I am sure he knows about Feynnman's technique.
@fu1rkan
@fu1rkan 4 ай бұрын
I love the way how you explane that!
@piotrmazgaj
@piotrmazgaj 5 ай бұрын
This is my seal. I have watched the entire video, understood it, and I can explain it in my own words, thus I have gained knowledge. This is my seal.
@buddhavlr1500
@buddhavlr1500 Жыл бұрын
Thank you for your tutorials man!
@learnwithraj23
@learnwithraj23 5 ай бұрын
One of the best explanation thanks Bro
@DutchSapper
@DutchSapper 2 ай бұрын
Thanks !! good explanation
@rajesh_nambi
@rajesh_nambi 5 ай бұрын
Very Good Explanation.
@WisdomInExperience
@WisdomInExperience 5 ай бұрын
what about variables declared in other files in global scope ? are they acceible outside that file in global scope ? what is diff between let and var ?
@Just_Jen1509
@Just_Jen1509 4 ай бұрын
The stalker analogy 😂😂😂😂
@ftzah1542
@ftzah1542 Жыл бұрын
Well done man thanks ❤
@AhmedAlbably
@AhmedAlbably 11 ай бұрын
really awesome you are the best ever
@638_umarsheik8
@638_umarsheik8 Жыл бұрын
Great man
@Jvst-bg9wg
@Jvst-bg9wg Жыл бұрын
Thank you 🎉
@saraelkady5033
@saraelkady5033 21 күн бұрын
amazing
@tamekkaknuth9612
@tamekkaknuth9612 Жыл бұрын
Exactly 20000% confident
@cirog.9341
@cirog.9341 Жыл бұрын
thank you Bro!
@hunin27
@hunin27 Жыл бұрын
Hi Bro, couldn't you declare (even if it's bad practice) a local variable to be global inside of a function? For example in python you do: global x = 5. even if it is declared inside of a function it is now global and accessible everywhere. Much love ❤
@sarcasmclub
@sarcasmclub 6 ай бұрын
i know it's been 8 months since you asked but i was just playing with the scope and variable and noticed that if you do not use let ,var ,const to declare a variable inside a function it creates a global variable which can be accessed from anywhere Example: function myFunc() { num = 3; // didn't use var let const before the variable name // also works with function sayhi = function () { console.log("sayHi"); }; } myFunc(); // You have to first call this function // not calling will result in not defined console.log(num); // it prints the value i.e, 3 even though num is inside function myFunc sayhi(); // you can call this function without error // Not using "let" "const" "var" when declaring variable inside function creates global variables
@the_n_ecromancer
@the_n_ecromancer 3 ай бұрын
I thought you would explain var keyword
@litium54
@litium54 2 ай бұрын
creepy guy ahahaha maybe he is just waiting for the bus (?)
@DamianDemasi
@DamianDemasi 9 ай бұрын
Variables defined with `let` aer scoped to blocks and functions, and can be reassigned Variables defined with `const` are scoped to blocks and functions, and cannot be reassigned Variables defined with `var` are scoped to functions or global (if define in block), and it can be reassigned ``` // Block { var aVar = 1; console.log('aVar', aVar); let aLet = 2; console.log('aLet', aLet); const aConst = 3; console.log('aConst', aConst); } console.log('aVar', aVar); // console.log('aLet', aLet); // Fails // console.log('aConst', aConst); // Fails // Function function myFunc() { var aFuncVar = 10; console.log(aFuncVar); } myFunc(); // console.log(aFuncVar); // Fails ```
JavaScript TEMPERATURE CONVERSION PROGRAM 🌡️
16:18
Bro Code
Рет қаралды 21 М.
JavaScript FUNCTIONS are easy! 📞
12:14
Bro Code
Рет қаралды 54 М.
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН
Tuna 🍣 ​⁠@patrickzeinali ​⁠@ChefRush
00:48
albert_cancook
Рет қаралды 148 МЛН
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 958 М.
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
Learn JavaScript Scoping In 10 Minutes
11:39
Web Dev Simplified
Рет қаралды 64 М.
My 10 “Clean” Code Principles (Start These Now)
15:12
Conner Ardman
Рет қаралды 319 М.
Javascript Promises vs Async Await EXPLAINED (in 5 minutes)
5:50
Roberts Dev Talk
Рет қаралды 624 М.
#39 Understanding JavaScript Scope | JavaScript Full Tutorial
16:11
Learn JavaScript ARROW FUNCTIONS in 8 minutes! 🎯
8:02
Bro Code
Рет қаралды 48 М.
JavaScript Functions Crash Course
1:36:54
freeCodeCamp.org
Рет қаралды 202 М.
If You Cannot Name All 5 JS Scopes You Need To Watch This Video
15:06
Web Dev Simplified
Рет қаралды 62 М.
JavaScript Let vs Var vs Constant | Mosh
6:51
Programming with Mosh
Рет қаралды 294 М.
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН