16.1: let vs var - Topics of JavaScript/ES6

16.1: let vs var - Topics of JavaScript/ES6

The Coding Train

6 лет назад

222,057 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@rdscleaners
@rdscleaners - 03.09.2023 20:30

Love your videos and explanations of topics so everyone can understand :)

Ответить
@janjeromesoriano1182
@janjeromesoriano1182 - 10.03.2023 06:23

Thank you!

Ответить
@alephzero7808
@alephzero7808 - 29.12.2022 22:22

var x = 0 do console.log(x) while(x>o)

Ответить
@eduardoguimaraes5226
@eduardoguimaraes5226 - 21.10.2022 18:36

You r just perfect!

Ответить
@emmakent3681
@emmakent3681 - 10.10.2022 21:48

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() // ;)

Ответить
@xj770HUN
@xj770HUN - 14.09.2022 22:33

He is the Professor from money heist but IT professional. :D

Ответить
@WistrelChianti
@WistrelChianti - 11.08.2022 15:42

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.

Ответить
@itskittyme
@itskittyme - 10.07.2022 08:03

i came here for the let,
but i stayed for the jokes xD

Ответить
@Zen-lz1hc
@Zen-lz1hc - 17.06.2022 21:12

This was one of the most entartaining video that I watched on `let` and `var` pretty fun, thank you :)

Ответить
@leeloohad
@leeloohad - 18.05.2022 19:22

When I'm down I watch Coding train videos and the sun shines again :) Thanks for being such an awesome human being and teacher!

Ответить
@obedotto4465
@obedotto4465 - 02.05.2022 21:37

I almost always use let and never use var.

Ответить
@julians.2597
@julians.2597 - 27.04.2022 00:57

"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.

Ответить
@bballer110787
@bballer110787 - 17.04.2022 13:16

This video was fantastic.

Ответить
@ilearncode7365
@ilearncode7365 - 04.04.2022 20:59

Shouldnt the error be "i is not initialized"? Saying it is "not defined" is wrong because something not being defined doesnt throw an error. If you do "let i; console.log(i)", it doesnt throw an error even though it is not defined.

Ответить
@nirahhp999
@nirahhp999 - 09.03.2022 14:55

I need some help on node loop

want to print n elements from the array after 10 seconds till complete array in a node so which is a better way

ex:
array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

print:
1
2
sleep 10 sec
3
4
sleep 10 sec
.
.
9
10

in this way

Ответить
@franksimon8375
@franksimon8375 - 05.03.2022 23:52

Human body? Do you even lift, bro?

Ответить
@TheNewGreenIsBlue
@TheNewGreenIsBlue - 24.01.2022 20:04

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]".

Ответить
@TheNewGreenIsBlue
@TheNewGreenIsBlue - 24.01.2022 19:52

"2015... which is quite a while ago at this point [in 2017]" me watching in 2022... 👁👄👁

Ответить
@ARandomPerson--
@ARandomPerson-- - 19.01.2022 17:47

Thank you bearded angel in human skin!!

Ответить
@uushk6631
@uushk6631 - 09.01.2022 07:58

whenever i saw you, i laugh lol <3

Ответить
@paraskaushik2639
@paraskaushik2639 - 16.12.2021 19:23

wow

Ответить
@JanneWolterbeek
@JanneWolterbeek - 26.10.2021 15:55

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!

Ответить
@xanthoconite4904
@xanthoconite4904 - 05.10.2021 00:00

very informative

Ответить
@YaronVegOfficial
@YaronVegOfficial - 24.09.2021 23:37

expertly explained.

Ответить
@shehryarmalik5704
@shehryarmalik5704 - 04.09.2021 07:08

best teacher no cap

Ответить
@sayantaniguha8519
@sayantaniguha8519 - 21.07.2021 12:21

for(var i=1;i<=5;i++)
{
setTimeout(function(){ console.log(i) },1000);
}

Why does it give o/p 6 ?
It should give
1
2
3
4
5
...but it isnt,, whyy ??..
Plz give me an explanation related to hoisting

Ответить
@yiannimitropoulos3913
@yiannimitropoulos3913 - 13.07.2021 13:55

If we manage to invent full-fledged robots but we're still stuck with JavaScript we'll know that our civilization has FAILED, lol

Ответить
@why4han5lr7
@why4han5lr7 - 01.07.2021 19:20

Let allow or acess only in block
Var allow or acess in entire function it belongs

Ответить
@sayochikun3288
@sayochikun3288 - 01.07.2021 15:42

kg vs lb

Ответить
@pranavdixit8593
@pranavdixit8593 - 01.07.2021 03:47

too much drama.

Ответить
@umoooo
@umoooo - 21.06.2021 13:44

you should delete the part you said wrong, now i will confuse var and let rest of my life

Ответить
@iq0578
@iq0578 - 15.06.2021 18:36

I have always used let, but I didn't know why until now :)

Ответить
@muhammadjunaid3684
@muhammadjunaid3684 - 11.06.2021 20:10

What's your age, Sir?

I'm 17.
It helped me a loooooot.

Ответить
@divyanshubarpanda8549
@divyanshubarpanda8549 - 08.06.2021 09:55

I am a beginner. I know java But not script can you make it more basic. please

Ответить
@MM-oq1lb
@MM-oq1lb - 04.06.2021 02:10

You look such a fun person but I don't understand a thing. I wonder if there is any tutorial that teaches not another tech dudes but rather real beginners.

Ответить
@lightbombs
@lightbombs - 03.06.2021 17:30

get to the poiiiiinnnnntttttttttttttttttt

Ответить
@seranes_silence
@seranes_silence - 17.05.2021 18:36

so the short version of this is: always use let ?

Ответить
@officialakm674
@officialakm674 - 10.05.2021 17:38

programmer in 2021: Oh this is useful
programmer since 2015: who makes videos on this topic 😑

Ответить
@hassanshahzad3922
@hassanshahzad3922 - 10.05.2021 16:20

He is the one of the best presenter i have seen in my life.

Ответить
@gauravpratapsingh1575
@gauravpratapsingh1575 - 04.05.2021 08:32

Now let also supports hoisting

Ответить
@ganpatsingh8233
@ganpatsingh8233 - 12.04.2021 09:59

So finally I understand the difference between let and var

Ответить
@nithishraina3306
@nithishraina3306 - 08.04.2021 16:55

Your behind my scene 😍

Ответить
@ucthangnguyen4337
@ucthangnguyen4337 - 21.02.2021 20:02

let: Look at me I'm the var now :>>

Ответить
@user-sh8kx8kl7c
@user-sh8kx8kl7c - 19.02.2021 08:25

what I like about your videos is I don't feel like I'm studying at, all pretty cool .. sometimes I just play them in the background and sleep (this mean they reach the level of comfort to me which not so many can do)
but what I dislike about you is you're always putting yourself down and not believing in what you already have which's annoying

just a flying opinion :)

Ответить
@maremmaladra292
@maremmaladra292 - 28.12.2020 19:33

Great work, you are the best: keep It on!

Ответить
@kaunjovi8350
@kaunjovi8350 - 23.12.2020 08:14

Does hoisting happen in case of let also? Or any similar transpiling on let keyword before the interpreter can actually work on the instructions?

Ответить
@nhimoc910
@nhimoc910 - 15.12.2020 04:04

ya allah plz forgive me stop watching this.

Ответить
@Al-Misanthropic-Bundy
@Al-Misanthropic-Bundy - 12.12.2020 15:30

JavaScript was conceived as a shit language. The creator even used the word Java because Java was popular back then. Smh. I wish there was a better language for web scripting. Fml

Ответить