DEV Community

Discussion on: Random colour with JavaScript

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

parseInt('ffffff', 16) would be more straightforward and easy to refractor.

BTW, parseInt('ffffffff', 16) if you need alpha channel (opacity).

It seems that 0xFFFFFF also works.

Collapse
 
telmo profile image
Telmo Goncalves

Thanks 🙏