There is a <h1 id="title">Title</h1>
in a html file.
Now if I want to change its content from a js file.
I always do this:
var el = document.getElementById("title");
el.innerHTML = "Hello world!";
But Now, I am able to do this:
title.innerHTML = "Hello world!";
I want to know if the second method is okay because everywhere it is mentioned to go with the first method and there is no mention of the second method anywhere?