loading...

Discussion on: Generate and Set Pseudorandom Hexadecimal Background Color Using JavaScript

Collapse
chiff profile image
Chiffre

TL;DR - you don't want to use that

@dood also every #ID is in DOM is accessible via window[id] however it's diacouraged to use that because it was implemnted in browsers due historic and compatibility reasons. More info here. It can be removed in future and make your page not working. Check answers and comments too. What I wanted to say is that window.body could be accessible because of same reason (I'm not sure).

Collapse
somedood profile image
Basti Ortiz (Some Dood)

Oh, wow. I never even knew that you could access an id from the window object. Thanks for making me learn something new today! I am genuinely surprised and amused by this.