Recently, when I am working on some javascript code, I found that I can get a html dom by using a variable which has the same name with the html dom's ID property. For example:
<input type="hidden" id="foo" value="100">
console.log(foo.value);
I can get the value of foo dom. The result is 100.
The question is: Is it a syntax sugar from browser(some javascript parser such as V8)? Can I get doms by this way?
Any help will be appreciated!