DEV Community

Discussion on: Know the difference between theses JS concept in order to skill up #1

Collapse
codeoz profile image
CodeOz Author

Yes and moreover, it can be dangerous to create global variable in general since you can easily override it

Thread Thread
aarone4 profile image
Aaron Reese

Sort of. You should declare it globally BECAUSE you intend to modify it within a localised scope. This is how the js frameworks work. Vue is effectively a Global object which can have it's properties manipulated by the functions within it. but then we are getting into immutability and state management.