3 ms·
An unrelated javascript technique I learned on HN sometime ago. `document.getElementById("id")` can be replaced by `window["id"]`.
by smusamashah 5y ago
An unrelated javascript technique I learned on HN sometime ago.
`document.getElementById("id")` can be replaced by `window["id"]`.
- onion2k 5y agoThat seems like a dangerous idea to me. If you decided to have an element with an ID of, say, "print" you'd end up getting the window.print method instead of the DOM element you're expecting.