3 ms·
More specifically it becomes a property of window, which is the global object. So <div id="hello"> becomes accessible as window["hello"], which means you can j
by chmod775 9mo ago
More specifically it becomes a property of window, which is the global object.
So <div id="hello"> becomes accessible as window["hello"], which means you can just directly write hello.innerText = "Hi!".
Since this may conflicts with any of the hundreds of other properties on window, it's generally not something that should be used.
Historically it wasn't too uncommon to see it, but since it doesn't work well with typescript, it's very rare now.
- AlienRobot 9mo agoYou can make it work with typescript by declaring it as an HTMLElement without defining it.