Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript generate random Hex

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

console.log(randomHex());
// Result: #92b008
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #javascript #generate #random #Hex
ADD COMMENT
Topic
Name
2+1 =