Тёмный

16.1: let vs var - Topics of JavaScript/ES6 

The Coding Train
Подписаться 1,7 млн
Просмотров 222 тыс.
50% 1

In this video, I cover the "let" keyword in ES6 JavaScript. I discuss the differences between "let" and "var" (block scope vs. functional scope).
Video on "const": • 16.2: const - Topics o...
Support this channel on Patreon: / codingtrain
To buy Coding Train merchandise: www.designbyhumans.com/shop/c...
To Support the Processing Foundation: processingfoundation.org/support
Send me your questions and coding challenges!: github.com/CodingTrain/Rainbo...
Contact:
Twitter: / shiffman
The Coding Train website: thecodingtrain.com/
Source Code for the all Video Lessons: github.com/CodingTrain/Rainbo...
p5.js: p5js.org/
Processing: processing.org
For an Intro to Programming using p5.js: • Start learning here!
For Coding Challenges: • Coding Challenges
Help us caption & translate this video!
amara.org/v/dXl2/
📄 Code of Conduct: github.com/CodingTrain/Code-o...

Опубликовано:

 

27 сен 2017

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 352   
@pierrem2983
@pierrem2983 6 лет назад
i learned programming & javascript thanks of you Dan because i wanted to do generativ art, now i'm a web developer it's my full time job, thank you :)
@khw9082
@khw9082 4 года назад
Would you mind telling me how long it took? I am learning as well.
@r_u_p_d9776
@r_u_p_d9776 4 года назад
@@khw9082 if you practice daily it would take only 1-1.15 months to master JS (only);
@khw9082
@khw9082 4 года назад
@@r_u_p_d9776 thanks a lot
@r_u_p_d9776
@r_u_p_d9776 4 года назад
@@khw9082 no problem buddy.
@Bayo106
@Bayo106 4 года назад
@@khw9082 lol this is not true. Even javascript developers with 5 years experience have not mastered Javascript
@DavidBadilloMusic
@DavidBadilloMusic 5 лет назад
"A variable should have the smallest scope that is needed." I like that.
@crehenge2386
@crehenge2386 6 лет назад
European concortium of mango loving astronauts, sounds reasonable xD
@sck3570
@sck3570 6 лет назад
Lmao
@MarkAhlquist
@MarkAhlquist 3 года назад
Mangonauts!
@irrelevanceuk
@irrelevanceuk 3 года назад
😆
@leeloohad
@leeloohad 2 года назад
When I'm down I watch Coding train videos and the sun shines again :) Thanks for being such an awesome human being and teacher!
@jackhales6179
@jackhales6179 6 лет назад
This doesn't have to be re-done as you said in the video, this is nice honestly, there are so many boring programming videos on the web that the enthusiasm really helps, similar feelings to CodeCourse :) Keep it up man, 10/10
@theanthologist9567
@theanthologist9567 5 лет назад
Love your stuff, Dan! You're becoming my go-to resource, whenever I'm confused about a concept. Keep up the good work!
@goncalopedro9054
@goncalopedro9054 5 лет назад
By playing around with var and let I kind of got the idea of how it worked but once you explained that "hoisting" term, things really got clear and I remembered what my high school programming teacher used to say regarding C++ and Pascal: "If you're going to declare something, do it at the top of the file!". That really clicked in my brain once you explained what hoisting was :D Keep up the good work bro. You're killing it!
@theantibeta
@theantibeta 6 лет назад
ECMAScript === European Computer Manufacturers Association Script
@BloodyScythe666
@BloodyScythe666 6 лет назад
I think that'd be single equal since triple equal will compare those two and will return false :P
@theantibeta
@theantibeta 6 лет назад
Right, but, did you see that decorator '
@BloodyScythe666
@BloodyScythe666 6 лет назад
Fair enough!
@hishammubarak3421
@hishammubarak3421 6 лет назад
Thank you
@sharank
@sharank 6 лет назад
I dont know. It looks like dickbutt to me
@dankang06
@dankang06 6 лет назад
Awesome video -- your breakdown of the differences between var and let was perfect. I love the energy too. Thanks!
@nicksmeta
@nicksmeta 3 года назад
Wow, amazing! Your explanation style is so verbose (in a good sense) that I can just listen to many of the videos, while doing chores and stuff, and understand the ideas being presented. Simply marvelous!
@franksimon8375
@franksimon8375 2 года назад
Yeah I do that
@jermainebrayne437
@jermainebrayne437 6 лет назад
this was perfectly explained, love the energy!
@gagangupta1255
@gagangupta1255 6 лет назад
Awesome video - very clearly defined the diff between var and let !!
@TheCodingTrain
@TheCodingTrain 6 лет назад
Thank you!
@JanneWolterbeek
@JanneWolterbeek 2 года назад
This is actually very informative AND entertaining/funny. That is unique, not many have this talent. Makes learning much easier for people like me! Thanks!
@VantageVibesWorld
@VantageVibesWorld 6 лет назад
man you are funny and also explaining in good detail at same time. i love this kind of presentation. thank you.
@ciwanye2291
@ciwanye2291 5 лет назад
This guy made me love programming through his lessons thanks man !
@thechenoutdoors3050
@thechenoutdoors3050 5 лет назад
best video out there explaining let vs. var!
@sowmyavijayakumar9766
@sowmyavijayakumar9766 6 лет назад
Wow..this is excellent stuff..i have been wracking my head over let vs var for a while and I finally get it!
@mattgraves3709
@mattgraves3709 5 лет назад
Exactly the same issue I have with scope, I learned how to program with Java and think in the same fashion. You are a great teacher! Thank you
@bearded-cat
@bearded-cat 6 лет назад
I am learning JS on free code camp now and you explain things so well its surprising easy for me to fill out challenges. thanks a lot and please keep making more videos! its a shame that i havent found your channel earlier
@jojojawjaw
@jojojawjaw 6 лет назад
Crystal clear explanation of the difference, thanks a lot! ♥ I've been using var all my life (more like for the few months ago), thinking that the variable is limited to its block like C++ and Java, after watching this, I was like what!
@lleytonmorris6305
@lleytonmorris6305 6 лет назад
thank you so so much. you started using let a while back and I asked my qualified friend to explain why and it didn't make sense other than they had different use cases... der. after listening to this video it makes absolute sense and i will 100% be using let for, at least, my for loops. your videos are my biggest inspiration and I am just so glad that through whatever round about way, you are able to explain to me at least how all these abstract things work.
@TheCodingTrain
@TheCodingTrain 6 лет назад
Thank you!
@heksqer1022
@heksqer1022 5 лет назад
This was a great video !! This had me confused for a loooong time !
@roltthehunter
@roltthehunter 6 лет назад
Great video, i just started coding, in JS coming from a background in C++, and and i mostly learned to code JS from mini bootcamp that used ES6 and now i am going back and doing intro courses, and a lot of them use var and stuff and write in in concatenated strings over just using a template string, i much prefer the ES6 stuff and i am glad i learned it first.
@MegaARYARAJ
@MegaARYARAJ 5 лет назад
Interesting JavaScript tutorial..this is the best video I got till now about the differences between var and let..
@mrshurukan
@mrshurukan 6 лет назад
Awesome video! Thanks, now I'll use "let" as well, because I'm used to think about "block scope" and not "function". Very interesting stuff, thanks a lot!
@nikeethamusic330
@nikeethamusic330 4 года назад
Love the way you simply even the most complex topics!!
@Evuce1000
@Evuce1000 5 лет назад
Not boring at all! Love your lessons!
@hassanshahzad3922
@hassanshahzad3922 3 года назад
He is the one of the best presenter i have seen in my life.
@tyfooods
@tyfooods 5 лет назад
I reaaaaaallly like your videos and teaching style. Keep on keeping on!
@jorge88824
@jorge88824 5 лет назад
The first time I've watched a video from this channel I was thinking "what is wrong with that guy?". After the ending of the first video I've realized how good Dan's explanations are. Since then I'm following his videos and enjoying the way of braking difficult concepts into small pieces. I've learned a lot about JS and found answers of a lot of questions I've asked myself. Keep going, man! 10x for creating this amazing channel and being a person you are! Greetings from Bonn, Germany.
@bunderland
@bunderland 4 года назад
There is nothing wrong with him :) He has a great personality.
@joshua_tobler
@joshua_tobler 4 года назад
That was actually super helpful. I'm graduating from Google Apps Script to real Javascript and doing some game and graphics coding for the first time, and this explained > 25% of the language barrier I was encountering.
@ky-effect2717
@ky-effect2717 3 года назад
Thank you! This is exactly what I was looking for and very well explained.
@luismuzquiz1400
@luismuzquiz1400 6 лет назад
Very entertaining explanation. Thanks!
@vivekraj9875
@vivekraj9875 4 года назад
Happy teachers day Dan,😘😘,,, You're the best teacher I've ever seen... And You're attitude towards teaching is just Awesome 😀😀
@ga7853
@ga7853 5 лет назад
You are magnificent, and the way you made your videos is unbelievable fantastic, I have not seen anyone pro or regular who made such good videos that are pleasant to watch like you did, like if I'm sitting in a great school, Thank you a million for your great way of explaining and for those wonderful great videos that made learning fun.
@sharpfocus9572
@sharpfocus9572 3 года назад
Hoisting and Nested loops is an nightmare for many people I think , you are an excellent teacher , your way of learning us is fantastic , the class table's explanation is the key to success , many greetings my friend !!
@JackFlashTech
@JackFlashTech 4 года назад
This is really interesting. I had thought that it was some kind of optimization around declaring constants and variables that could change as functional programming became more fashionable. Thanks.
@rdscleaners
@rdscleaners 10 месяцев назад
Love your videos and explanations of topics so everyone can understand :)
@Zen-lz1hc
@Zen-lz1hc 2 года назад
This was one of the most entartaining video that I watched on `let` and `var` pretty fun, thank you :)
@ritikkhatri
@ritikkhatri 6 лет назад
That was a very nice explanation!!
@iq0578
@iq0578 3 года назад
I have always used let, but I didn't know why until now :)
@martin-xq7te
@martin-xq7te 5 лет назад
Very well explained. I am starting out with Javascript so a good piece of timing for me. Ive also looked at your video on Genetic Algorithms in P5.js. If viewers have not seen that its well worth a look. If you have a pdf of that video I would buy it. Keep up the good work
@tobiumevolume9890
@tobiumevolume9890 6 лет назад
Amazing video, would have saved me thousands of lines of code if i had informed myself about let before ^^
@tobiumevolume9890
@tobiumevolume9890 6 лет назад
Yaay, i got a heart :D
@MrFLAWl355
@MrFLAWl355 6 лет назад
YES! promises and promises chaining PLEASE!
@emmakent3681
@emmakent3681 Год назад
Awesome, thank you! Best explanation for this that i've read/watched. Sidenote: when i was running the example where 100 was expected, i was getting undefined. I needed to run setup() after, so that part stumped me for a bit. function setup() { for (var i = 0; i < 100; i++); } console.log(i); } setup() // ;)
@WistrelChianti
@WistrelChianti Год назад
Thanks so much for this. I had been wondering and had been meaning to find out at some point but your examples were superb to effectively demonstrate the difference. Amusingly I'd never realised that "for (int i = etc" in C++ only had i in scope inside the loop. I mean it makes sense but I was never consciously aware of it. I guess I rarely tried to re-use the counter outside of the loop, or if I did, I guess I must have fixed it on auto-pilot without really thinking about it properly.
@Sleepytj007
@Sleepytj007 3 года назад
Thank You for sharing your knowledge.
@justgaming3794
@justgaming3794 5 лет назад
Love your stuff Daniel
@ades3967
@ades3967 4 года назад
Fantastic explanation of Hoisting in JavaScript!
@julians.2597
@julians.2597 2 года назад
"let" is a keyword frequently seen in functional programming languages, which JS is slowly inching closer to becoming at least a language that allows for fully functional code.
@Karlponken
@Karlponken 5 лет назад
Great explanation! Thanks for this video!
@Messirobben047
@Messirobben047 6 лет назад
I wish all the teachers in colleges were like you. Amazing Skill.
@joushwashahzad2341
@joushwashahzad2341 4 года назад
Best Explanation ever on Let
@rrutter81
@rrutter81 4 года назад
You present in a very entertaining way. One thing you missed was lexical scope with let vs var. Think setInterval method. I tripped up an interviewer on this when they were looking for a closure answer. subscribed
@TheCodingTrain
@TheCodingTrain 4 года назад
Thanks for the feedback!
@darkthrongrising5470
@darkthrongrising5470 6 лет назад
This is actually really good to know.
@maremmaladra292
@maremmaladra292 3 года назад
Great work, you are the best: keep It on!
@ilovesalmon215
@ilovesalmon215 3 года назад
Thanks!
@deleater
@deleater 5 лет назад
over 9000 blessings to you sir for explaining this.
@SpencerDavis2000
@SpencerDavis2000 4 года назад
great video. I didn't even know what block scope or function scope was, just knew it was different and tricky. Now I know. thank you so much. Subscribed! looking forward to more of your videos :-)
@LawZist
@LawZist 6 лет назад
exactly what i was looking for . now i know the differences
@thecowbox
@thecowbox 6 лет назад
Daniel shiffman: Legend. I tell everyone this.
@cm_dev
@cm_dev 2 года назад
This video was fantastic.
@Loppy2345
@Loppy2345 6 лет назад
This video is a gem.
@footballarena6562
@footballarena6562 4 года назад
i started learning python but stopped to learn js because of this channel. I love the way you teach and your contents.
@mahyarazad
@mahyarazad 4 года назад
Man, I love your style. It's heuristic 😎😃
@orki974
@orki974 4 года назад
This it, "function scope", that's the root of the evil I feel about JS, that's why I feel so bad about it. It's also the main reason why I generally don't understand where a value comes from when I read JS : thank you very very much. I'm a C++/Clojure/Rust etc programmer and this is a major difference between JS and other languages in the world that distinguish JS! I completely understand why you prefer "block scope": you're a sane person, and I like that
@keen123
@keen123 6 лет назад
Very helpful! Thanks Dan!
@Kafka8233
@Kafka8233 3 года назад
So finally I understand the difference between let and var
@vishnuumakanthan9583
@vishnuumakanthan9583 5 лет назад
Very informative video , Thanks a Lot!
@alialrahem9817
@alialrahem9817 4 года назад
Very clear thank you for the video
@kaunjovi8350
@kaunjovi8350 3 года назад
Does hoisting happen in case of let also? Or any similar transpiling on let keyword before the interpreter can actually work on the instructions?
@bearded-cat
@bearded-cat 6 лет назад
wow thats so well explained! thanks a lot you have new subscriber now
@dertyp6833
@dertyp6833 6 лет назад
2:54 - 3:00 Aaaaaaaaaargh!
@sandeepvk
@sandeepvk 6 лет назад
I don't use JS anymore but I am subscribed because you are so much fun to watch
@playerthree5742
@playerthree5742 6 лет назад
Great example! sometimes errors can be good news as well !
@StrangeComments
@StrangeComments 6 лет назад
You explained this very well
@sumer9999
@sumer9999 5 лет назад
You are awesome , so are your videos
@UnknownUnknown-tx1jc
@UnknownUnknown-tx1jc 6 лет назад
Great tutorial. It really helps when I don't feel like reading documentary. oh I guess why they didn't think about modifying the var to be block scope is because many websites still uses var. If they would have change it some websites, would have been broken and you could imagine the problems that would stur up. By the way block scope is really cool
@martin_orue
@martin_orue 4 года назад
Excellent! Thank you!
@eandresrodriguez
@eandresrodriguez 5 лет назад
Best teacher ever!
@BloodyScythe666
@BloodyScythe666 6 лет назад
thank you for the explanation. wondered for quite some time now what's the actual difference and why to use it instead of var. you could have probably put the const explanation inside this video. 12 minutes isn't too long and it would be all in one place. other than that, great video, dan!
@HarshTalpada
@HarshTalpada 6 лет назад
Daniel, you are always off track. But that is the best part of your way of teaching. Getting off track is indeed necessary for making learning an easy task. Get off track as often as you can, and people will still love you. I just wished you were here in Melbourne. Would have definitely learned all this from you in person.
@TheCodingTrain
@TheCodingTrain 6 лет назад
would love to visit Australia someday, have never been!
@dearnobitaa
@dearnobitaa 5 лет назад
European Computer Manufacturers Association (ECMA).
@thehumbledprogrammer8833
@thehumbledprogrammer8833 6 лет назад
nice video sir! you made my understanding clear!
@TheCodingTrain
@TheCodingTrain 6 лет назад
Glad to hear!
@zemalex89
@zemalex89 4 года назад
Great video!
@TheNewGreenIsBlue
@TheNewGreenIsBlue 2 года назад
let was likely used because it's often used as a keyword in functional programming keywords for a long time. It's also used in mathematics to assign values to algebraic values. In terms of linguistics, you're asking the compiler to "please *LET* x *equal* [value]".
@boozer69n
@boozer69n 6 лет назад
Great explanation, thanks for the video. =)
@aymanafzal
@aymanafzal 5 лет назад
A new subscriber... Great explanation
@chang112x
@chang112x 5 лет назад
thx. Finally someone explained to me.
@vincesanchez7790
@vincesanchez7790 5 лет назад
Let is useful :) Thanks man Now i get it
@AmirAli-kj5bm
@AmirAli-kj5bm 4 года назад
thanks, really helps me a lot
@user-jy9qp4uw5f
@user-jy9qp4uw5f 6 лет назад
Hello, very interesting video considering all the new frameworks of javascript and the popularity that it has gained ( React js etc.). Do you plan making a video about immutable js?
@ericaepperson8928
@ericaepperson8928 4 года назад
the best instructor everrrrrrrrrrrrrrrrr
@leonardgarthbrooks
@leonardgarthbrooks 4 года назад
This might sound like an odd question, but why can't I find this playlist on the Coding Train main RU-vid site? In fact, there are a few tutorial series that I can't seem to directly, including the p5 Sound one. Am I missing something?
@annaliistahevali771
@annaliistahevali771 4 года назад
This is what being high on JS looks like XD
@YaronVegOfficial
@YaronVegOfficial 2 года назад
expertly explained.
@sergiyrudenko905
@sergiyrudenko905 5 лет назад
Great video!!! Thanks a lot!!!
@evhwolfgang2003
@evhwolfgang2003 6 лет назад
So with let and var, the variable is typeless or dynamically typed?
@DevrajSinghRawat
@DevrajSinghRawat 5 лет назад
another awesome video ..
@xanthoconite4904
@xanthoconite4904 2 года назад
very informative
@nurharizulaimanmatharith4023
@nurharizulaimanmatharith4023 4 года назад
Nice explaination
Далее
16.2: const - Topics of JavaScript/ES6
7:42
Просмотров 74 тыс.
16.3: ES6 Arrow Function - Topics of JavaScript/ES6
22:32
Nice hiding.
00:43
Просмотров 3,8 млн
Осторожно селеба идет 😂
00:16
Просмотров 414 тыс.
Throbber #genuary7
0:53
Просмотров 40 тыс.
Genuary After Dark
0:58
Просмотров 12 тыс.
#genuary15 physics library!
0:40
Просмотров 189 тыс.
Enums considered harmful
9:23
Просмотров 196 тыс.
1.1: fetch() - Working With Data & APIs in JavaScript
15:39
Coding Challenge 183: Paper Marbling Algorithm
32:10
Просмотров 68 тыс.