STOP Declaring IDs!?! JavaScript Global Variables Best Practices

Publicado el: 29 diciembre 2020
en el canal de: codeSTACKr
16,024
984

🦸 Become A VS Code SuperHero Today: https://vsCodeHero.com
🧑🏾🤝🧑🏽 Join my Discord developer community:   / discord  

Did you know that you don't have to use getElementById() or querySelector() to access a DOM element that has an HTML ID?
HTML element IDs are accessible as global variables on the window object.
So, should we stop using `getElementById()` and `querySelector()`?
NO
Even though this does seem to be a convenient way to write a little less code, it should not be used.
It's always good practice to declare your variables.
_____________________________________
🚢 Deploy for FREE on Vercel: https://vercel.com/ambassadors/codest...
📚 FREE 7-Day trial at Treehouse: https://treehouse.7eer.net/codeSTACKr
_____________________________________

🛠️ Tools I use:
🟠 codeSTACKr Theme: https://marketplace.visualstudio.com/...
🟠 STACKr Code Font (Exclusive to my VS Code Course - https://vsCodeHero.com)
🟠 SuperHero Extension Pack: https://marketplace.visualstudio.com/...
_____________________________________

💖 Show support!
PayPal: https://paypal.me/codeSTACKr
_____________________________________

👀 Watch Next:
Playlist: Web Development For Beginners -    • Web Development - Beginners Roadmap (2019)  
_____________________________________

🌐 Connect With Me:
Website: https://www.codestackr.com
Twitter:   / codestackr  
Instagram:   / codestackr  
Facebook:   / codestackr  
_____________________________________

** Affiliate Disclaimer: Some of the above links may be affiliate links, which may generate me a sales commission at no additional cost to you.

#codeSTACKr #JavaScript #learntocode


En esta página del sitio puede ver el video en línea STOP Declaring IDs!?! JavaScript Global Variables Best Practices de Duración online en buena calidad , que subió el usuario codeSTACKr 29 diciembre 2020, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 16,024 veces y le gustó 984 a los espectadores. Disfruta viendo!