Generate random HEX color

PHOTO EMBED

Wed Jan 05 2022 11:25:35 GMT+0000 (Coordinated Universal Time)

Saved by @desiboli ##javascript ##js

const randomHex = () => `#${Math.floor(Math.random() * 0xffffff).toString(16).padEnd(6, "0")}`;
console.log(randomHex());
// Result: #92b008
content_copyCOPY

https://blog.devgenius.io/15-javascript-codes-you-will-always-need-e8569903dd1