DEV Community

Discussion on: 20 Killer JavaScript One Liners ☝️

Collapse
 
alexmelw profile image
Alex Melvin

I'd do padStart instead of padEnd bacause of the obvious reasons.

const randomHex = () => #${Math.floor(Math.random() * 0xffffff).toString(16).padStart(6, "0")};