Var vs Const vs Let (ES6) - Beau teaches JavaScript
Vložit
- čas přidán 8. 02. 2017
- Learn about the difference between const, var, and let in JavaScript ES6 (ECMAScript 6).
Code
🔗 codepen.io/beaucarnes/pen/MbMN...
Other resources on topic:
🔗 www.jstips.co/en/keyword-var-v...
🔗 • var, let and const - W...
Beau Carnes on Twitter: / carnesbeau
⭐JavaScript Playlists⭐
▶JavaScript Basics: • JavaScript Basics Course
▶ES6: • ES6 - Beau teaches Jav...
▶Design Patterns: • Design Patterns - Beau...
▶Data Structures and Algorithms: • Data Structures and Al...
▶Clean Code: • Clean Code - Beau teac...
-
We're busy people who learn to code, then practice by building projects for nonprofits. Learn Full-stack JavaScript, build a portfolio, and get great references with our open source community.
Join our community at freecodecamp.com
Follow us on twitter: / freecodecamp
Like us on Facebook: / freecodecamp
Follow Quincy on Quora: www.quora.com/Quincy-Larson
This is how you explain it, idk what's up with this 20 min vidoes, let vs var vs const
Sometimes it seems like ppl do philosophy...
Yeah, we are missing scope a little bit in depth here, what happens when its inside a function as CONST? and as Var? inside an if statement? etc...
check mmtuts video on this. The best!
jesus christ, no kidding. it was hell trying to find this beautiful explanation, i literally only needed to hear the first minute of it to understand.
Best exact ,to the point,explanation. Beautiful.
go beau! go beau! I love this guy!
crisp and clear,covered everything needed less than 4mins.THANKS
In less than 4 minutes you explained to me in an easily understandable manner what 30 minute videos and several pages of documentation couldn't get through my skull. Thank you!
same here bro.
Thank you once again Beau for clarifying.
Thank you for keeping it short and to the point.
Many thanks! Much clearer now!
Very helpful. Thank you!
tl;dr
let - local variables that can be changed
var - global variables that can be changed
const - constant variables that cannot be changed
Fucking thank you. Scoured the internet for this answer.
@@TealDaubs lol never thought this would help anyone
*tl;dw
@@martiananomaly no, *tl;dr. look it up
That helped a great deal thanks.
Clear explanations, thanks for sharing!
Thanks
Thanks a lot dude..
On point thankyou :)
good explanation
Does this mean we don't need to change or "increment" _i_ anymore? We can use _let_ in loops, and have all of them be _i = foo,_ _i < bar,_ _i++?_
Thank you for making this 80 times easier than Codeacademy lol
Thank you!!!!!!!!!!!!!!!!!!!!!
This guy makes you think you're watching this video at 1.5x speed
should you use let instead of var when you can or does it not really matter?
thanks bro
Everything is clear to me now. Thanks for explaining the difference between const, let and var.
Guys what do you think I should do : keep learning JS or start working as a content manager for a company?
you can push to a const variable thats important (:
ok the var and const is easy thing to remember when first learn, so the let key point is scoop right?
without explanation on hoisting, it is not clear why 'var' variable is already available even before it is defined.
It actually is. The JS engine 'hoists' a variable assigned with the var keyword out of the flow before it starts executing synchronously.
var also binds itself to window object, but let and const dont do that
what is the name of this complier ?
for(var i=1;i
Bro ...what are the basic things are known in js
I just use var, closures, and caps to indicate constants. I'll use const and let in 5 years once I don't need to depend on a compiler to interpret them.
Some people think you should never use var. I wouldn't go that far, though. 😃 medium.com/javascript-scene/javascript-es6-var-let-or-const-ba58b8dcde75#.sn9gfcmp6
Beau Carnes I'm looking forward to never using var
If we used code for hack, is that counting as for good, hack++ :D
Based.
let: block-lvl VARs - values can be changed
const: values never change
var: srsly u don need an explaination for dis:)
And if you use for(i = 0; i < 3; i++) without assigning neither let nor var keyword, the i becomes global variable.
watched at 0.5* speed
i can feel you, 0.75 here
slow CPU? "Human Processing Unit" LOL
did you know that semicolons are optional? Why bother then?
I’m new but it’s because sometimes they are required so it’s a good habbit to just use them even if they arnt
Also most other C based languages do require them, so it's a good habit to get into if you ever end up moving to other languages 👍
@@chexitout I disagree.
We should do our best to use the language syntax and idioms.
Ur voice is weird
should you use let instead of var when you can or does it not really matter?