re: Generate and Set Pseudorandom Hexadecimal Background Color Using JavaScript VIEW POST

re: This is a great read for beginners. I also wondered how to make a random color generator before in my early days. Also, you don't need to add an i...

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).


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.

code of conduct - report abuse