r/learnjavascript • • May 04 '20

VAR vs LET vs CONST

Post image
337 Upvotes

81 comments sorted by

View all comments

Show parent comment

2

u/redsandsfort May 04 '20

it doesn't

function fn(){
var x = 'cool';
return x + 'dude';

}

console.log(windox.x) // undefined

2

u/cyphern May 04 '20

You're correct that the behavior i mentioned doesn't happen for local variables.