Differences Between Var, Let, and Const
HTML-код
- Опубликовано: 9 ноя 2018
- You have probably watched many different tutorials, and you may have noticed that some tutorials use var to declare variables while others use let or even const. It can get confusing quickly on what the differences are between the keywords, so in this video I am going to be explaining everything you need to know about var, let, and const. I will be going over their differences as well as explaining what situations you should use each keyword.
If you have any suggestions for a JavaScript topic, please let me know in the comments below.
Let vs Const vs Var Article:
blog.webdevsimplified.com/202...
Twitter:
/ devsimplified
GitHub:
github.com/WebDevSimplified
CodePen:
codepen.io/WebDevSimplified
#VarVsLet #JavaScript #WebDevelopment
You have a super rare skill. It's rare to find someone who is both a skilled programmer AND a skilled teacher / communicator. Thank you for your videos
and Zach Efron level of handsome
Totally agree!
OMG!! I had seen 100000 videos whose explanations were extremely complicated, but you explained it in less than 5 minutes!! Thank you very much
And understandable
Mate, I must say, your hair is on fleek!
Another super-clear explanation. Love your video style, brevity, and way of explaining everything. Plain and simple!
6:36 I didn't know that. This is why I always watch your videos, even if I think I understand the subject before hand. Great work! 👍
It is a bit counter intuitive based on the name. You can use Object.freeze to create an object that cannot have the properties reassigned, but it will still let you reassign a nested property such as company.ceo.name = 'New name'
@@WebDevSimplified thanks for the tip! As I was watching the part I referenced earlier, I was wondering how we would assign constants to the properties of an object, so it's like you read my mind. :D
This was great, you speak at just the right speed and your voice is clear. This really helped me and my husband with something in our bootcamp.
You forgot to say one more thing: when you declare a variable with var keyowrd, this automatically creates a property inside the Window ojbject.. so, if you say for example: var x = 1; and after that you say: console.log(window)... you will see that in the window object you will find the property X with the value of 1. Instead, if you declare a variable with let or const, this won't ceate a property inside the Window object. I guess this was also very important to mention!
Thank you for the clear explanation! Currently, I'm learning HTML, CSS & Javascript and if I don't understand something, I'm firstly looking at your channel to find an explanation. If it doesn't exist on your channel, then I'm searching in other sources. You are a very good teacher, your videos are short, consistent and very clear, without any unnecessary content. Thank you very much for sharing your time to make these videos.
Would like to say, well done and thank you for a clear and concise explanation of the similarities, differences and when to use, Var, Const and Let.
Watched other videos and without doubt, you nail it better here with both explanation and example.
Will be watching more of your stuff as this was a great measure stick for the quality of teaching.
Keep up the great work.
learn so much important points and the actual difference ....thanks a lot
This is the best explanation I've ever seen. I do know the differences yet I learnt something new
This is complete explanation of let vs const vs var I have ever seen. Thanks Kyle 😊
Thank you man, was struggling to understand these basic concepts. You are a lifesaver.
I am just starting with JS and I was stuck with this like hell. You made it so clear. Thanks a lot!!
Amazing explanation. Simple and straight to the point. Thank you!
Thanks a billion, Kyle for explaining the difference among these keywords.
I never knew var worked like this, and I've been using Javascript almost daily for over 2 years. I always assumed it worked like let because I have a background in other programming languages and assumed it's scoping worked the same. So wild! Thanks for the clarification!
It was very crystal clear explanation thank you.
Thank you very much Kyle, This is great. Very explicit. I think I would begin using the 'const' instead of the 'var'
Thanks ✌️
I was wondering just that! Thanks so much
Thank you! This video was very helpful. Just what I needed.
Great video. Succinct, clear to understand, and I learned a lot. Thank you.
This was SO helpful. Thank you so much!
Super clear explanation, many thanks
Great great explanation.. you always here that the differences is the 'block scope' and then wonder, well, like within an if or for loop, but nobody else ever says that...
Whenever Kyle comes out with the JavaScript class that he is working on.... I am purchasing it. He is awesome! Thank you Kyle!
Thank you for the support! I start recordikg tomorrow!
You are the best teacher on RUclips.
Your videos are helping me out alot! Thank you ❤
Best Web Development I seen evrr
Basically, _let_ is _var_ done right.
huge thanks for the explanation, only you made it clear to me!
Yes I did learn something thank you very much man it was hard for me to understand this but you explained it in like less than 10 minutes lol you have a good day too :)
Hey thanks. earlier i had confusion about block scope and Function scope. Now its cleared.
Thank's bro that was a really clear explanation.
This video came just in time. We are going through Javascript and JQuery right now in my bootcamp!
I'm really glad to hear. If you run into anything that confuses you in the bootcamp feel free to let me know, and I can try to help or make a video on the topic.
@@WebDevSimplified Awesome will do!
Web dev here in the PH. "Man I love your videos, your making a great impact" //awesome
1)Declaration Let variable in a {} block scope can't be access outside of it
2)let name = value1, let name = value2, can't redeclare let twice
Instead of this should be written name=value2;
3)let can be change it’s value const can't as it is constant but it can change its object value.🙃
yeah, I was a little confused aswell but this video was made in 2018
You forgot to say one more thing: when you declare a variable with var keyowrd, this automatically creates a property inside the Window ojbject.. so, if you say for example: var x = 1; and after that you say: console.log(window)... you will see that in the window object you will find the property X with the value of 1. Instead, if you declare a variable with let or const, this won't ceate a property inside the Window object. I guess this was also very important to mention!
Great lesson!
Thank you, perfect explain.
Whenever I see that face, I know useful information is coming my way.
Simple, clear, and very helpful. Thank you as always!
thank you :D you shared more differences than my constructor in my Full-Stack Bootcamp! Will subscribe and watch all other videos of yours
thankyou for all the amazing explaining!
Checked 10s of video and this video told me hmm you understand this now . say thanks to him :) Thanks Dude
Best video on this topic
Thank you for the explanation. Well explained. !
great explanation. TY!
Clear and concise, Thank you
Great video !!!
Love it
This is truly simplified
Thanks a lot. You explain things really well.
Awesome tutorials! Thank you!
You made it so clear. Thanks a lot
you are a rare gem my friend!!!
That was awesome. Thank you
finally I understand the difference, thanks man A LOT
Helpful. Thank you.
thank you your explanation was very clear
very clear explanation! you are awesome!
Thanks for clarifying.
Love your channel
Really good explanation, for beginner level - if reading info only in text (with no visual examples), it gets confusing quickly on this topic. Cheers😉
You make a wonderful work 👍👍👍👍👍 thanks
Quite easy to understand. Thanks
Great tutorial, thanks!
So simple, thank you so much! If I search for something and see your face in the results, I am saved. :)
Awesome explanation !
Wonderful explanation.. Than you....
man you are teaching the things that are not widely discussed which is why i am going to subscribe. You have a true gift of teaching in simple terms. i enjoy your channel, especially the tutorial on promises
Thank you! I try to cover the topics that I know confused me or other people I know, because those will be the most helpful for others.
Great Video!
Great work! 👍
awesome explanation
Thank you bro, really helpful :)
Solid video!
Gr8 explanation.
Thank you so much bro.
well explained, thanks!
so so simple. Finally.
Thank you so much.
Good video finally understand and I could have used var for something I needed instead of saving it to local storage and grabbing it after 🤦♀️
Good old Java script, Let (no pun intended) us introduce "const" that does not allow for re-assigning to avoid human error so that it is "constant" except when it's not...
thanks for this now i know what to do 👍👍👍👍
I came from C#. It's pretty simple there. Use var for what you wanna change, const for what you don't wanna change; variable and constant. Simple language for simple people.
Thank you!
GOOD explaintion
you are the man ,!
loved it! Thanks.. Const, Let, Var .. it is :)
Thank you.
Problem solved
Thank you very much. Ur a good explainer....
THNX!!!
someone get this absolute master a stellar coding setup i.e a better keyboard
You the real MVP
thanks a lot man
you r jordi of webdev !!!!!!!
Been building sites for 30 years and always avoided JS due to pre jquery experience. Am now taking the time to relearn JS and node while I’m at it and I have to say I’m regretting not doing this sooner. I’ve been programming in C# php Perl VB and JS is a peace of cake by comparison .
Thanks God we have you to explain this!! thanks!! A lot! A mean that)
you are amaizing
Thanks Kyle
thank you alot
thanks kyle
Thanks!
I love your approach so much. Thank you.
I do have a fundamental problem though. Maybe you can consider making video of it. It is this:
When I create an external JS file, and I have in it, codes like functions, etc in it, only the first code or function works!
What should I do to ensure that different codes intended to fire at different Listeners, in the same file, work?