-1

Just learned the basics of js. In the tutorial he made an id with save-el, and then in js he used let saveEl = document.getElementById("save-el"). Why would I not just use saveEl as the id in html to save myself from having to type out the let command each time?

Tried it with the same tag but using camel case and it worked fine. What are the limitations?

wyatt
  • 1
  • Explicit is better than implicit. That's actually a [tag:python] mantra, but it's generally applicable to all programming. Don't be afraid to type. Trying to save a few characters isn't worth it. – deceze Sep 01 '23 at 04:10
  • *"Why would I not just use saveEl as the id in html to save myself from having to type out the let command each time?"* - you still need the let statement to save the `getElementById` result to a variable. Also you don't have to type it every time. Write it once and copy&paste it from then on. – Peter Krebs Sep 01 '23 at 07:26

0 Answers0