DEV Community 👩‍💻👨‍💻

Discussion on: Speed Up Your Javascript With These Simple Methods

hyrumwhite profile image

For that last one, it depends on where you're creating your variable. You declared a global variable in both cases if you're in the global context. Also, globals dont slow down code. They can make understanding and maintaining your code more difficult if used improperly.