r/learnjavascript • • Oct 26 '20

Javascript string 🔥

193 Upvotes

31 comments sorted by

View all comments

Show parent comments

21

u/I-DONT-WANT-GOLD Oct 26 '20

Why?

13

u/scandii Oct 26 '20 edited Oct 27 '20

downvoted for asking a question... this sub.

let has a block scope, i.e lives ans dies in the scope it is declared, whereas var is global or if in a function has a function scope and can be used anywhere.

this can lead to some nasty side effects and is as such not recommended.

6

u/I-DONT-WANT-GOLD Oct 26 '20

Yeah, sorry if it was such a dumb question, but I was genuinely asking. Thank you!

15

u/scandii Oct 26 '20

there are no dumb questions only stupid answers.

5

u/Hate_Feight Oct 26 '20

Only stupid people who fail to ask them...

1

u/beelzebut Oct 27 '20

You actually gave him a bad answer tho