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
  • 44,943
  • 87
  • 252
  • 365

0 Answers0