0

It seems like these two statements produce the same output.

console.log(myId)
console.log(document.getElementById('myId'))
<div id="myId">Hello World!</div>

Q: Is it safe to use myId instead of document.getElementById('myId')

Phillip Senn
  • 46,771
  • 90
  • 257
  • 373

0 Answers0