DEV Community

Discussion on: Let re initialized and declaring

Collapse
 
rhymes profile image
rhymes • Edited

Because a is undefined.

The first a is scoped inside a function. You're printing the a that's outside and undefined.

So, a inside f lives inside the f, but it has nothing to do with the other a, they just share the same name