loading...

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

TOP OF THREAD FULL DISCUSSION
re: randomHexColour = ()=>'#'+(~~(Math.random()*(2<<23))).toString(16).padStart(6,0);
 

This is awesome! Now I get to spend this afternoon understanding the code. Thank you.

 
() => `#${Math.floor(Math.random()*(16777215 + 1)).toString(16).padStart(6,"0")}`
code of conduct - report abuse