Created
October 2, 2021 21:56
-
-
Save sayyedhammadali/66aefe8e57d764031536640c2b65a446 to your computer and use it in GitHub Desktop.
Generate Random Hex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const randomHex = () => `#${Math.floor(Math.random() * 0xffffff).toString(16).padEnd(6, "0")}`; | |
console.log(randomHex()); | |
// Result: #92b008 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment