I often see in many javascript samples here, getting the object name by:
var id = document.getElementById("MyId");
id.play(); //MyId above is that of an <audio> element
In my javascript code, on chromebook and android, I can directly use the element id as object name without the first line above. Are ids now automatically mapped into the javascript namespace? For example, in the html I have,
<audio id="MyId" controls>
Then in the javascript, I can use the code below successfully:
MyId.play();
Could somebody please explain why I do not need to execute the getElementById() first?
Thank