DEV Community

Discussion on: 20 Killer JavaScript One Liners ☝️

Collapse
 
jonrandy profile image
Jon Randy 🎖️ • Edited

I think there is also an issue with your randomHex function - it will never return #ffffff since:

Math.floor(Math.random() * x)
Enter fullscreen mode Exit fullscreen mode

can only ever return values from 0 to x-1. You need to use Math.round()