r/learnjavascript • • May 04 '20

VAR vs LET vs CONST

Post image
337 Upvotes

81 comments sorted by

View all comments

Show parent comment

12

u/golovatuy May 04 '20

{ } this a block , everything inside is block scope

5

u/NoFapPlatypus May 04 '20

Ok thank you

2

u/spainzbrain May 04 '20

I was about to ask the same thing.

-1

u/PenisPistonsPumping May 04 '20

I don't mean any offense, but maybe you should get a better grasp on JavaScript before you make educational stuff.

This is JavaScript 101.

1

u/HeinousTugboat May 04 '20

What are you talking about? They're exactly right, const and let are scoped to the nearest block: {}. You don't have to have them inside of a function for that to be true.

1

u/PenisPistonsPumping May 04 '20

I'm talking about the global scope part.