DEV Community

Discussion on: Scope in Modern JavaScript

Collapse
 
torinthenoob profile image
Torin Zhou

I believe Var is function scoped.
And to reduce hoisting undefine issues we should never use var in our code.

Collapse
 
naftalimurgor profile image
Naftali Murgor

True, var is function scoped. Thanks for the feedback. Using var would be detrimental because it gets hoisted.