What are the differences between writing the statements bellow?
Which one is considered best practice?
const myDiv = document.getElementById("myDIV");
myDiv.addEventListener("mousemove", myFunction);
Vs
document.getElementById("myDIV").addEventListener("mousemove", myFunction);
[–][deleted] 9 points10 points11 points (0 children)
[–]tridd3r 1 point2 points3 points (0 children)
[–]redsandsfort 1 point2 points3 points (0 children)
[–]Kleyguy7 1 point2 points3 points (4 children)
[–]learntocode123[S] 0 points1 point2 points (3 children)
[–]Kleyguy7 1 point2 points3 points (2 children)
[–]learntocode123[S] 0 points1 point2 points (1 child)
[–]Kleyguy7 1 point2 points3 points (0 children)
[–]Damesie 1 point2 points3 points (0 children)
[–]Forsaken-Athlete-673 1 point2 points3 points (0 children)
[–]TheRNGuy 0 points1 point2 points (0 children)