Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Generate Random Hex Code

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

console.log(randomHex());
// Result: #92b008
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #Generate #Random #Hex #Code
ADD COMMENT
Topic
Name
2+9 =