DEV Community


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

antjanus profile image
Antonin Januska

I saw a tweet about this last week! Using document.querySelector('body') is actually more performant than using document.body. So I wonder if doing document.querySelector('#some-id') would still be faster than document.body! :)

Thread Thread
somedood profile image
Basti Ortiz (Some Dood)

I wonder if there's a jsPerf for that by now. I'm really curious to see which method is more performant.

Forem Open with the Forem app