Answers for "javascript generate random Hex"

27

js random hex color

'#'+Math.floor(Math.random()*16777215).toString(16);
Posted by: Guest on February-25-2020
0

random hexadecimal character js

const genRanHex = size => [...Array(size)].map(() => Math.floor(Math.random() * 16).toString(16)).join('');

console.log(genRanHex(6));
console.log(genRanHex(12));
console.log(genRanHex(3));
Posted by: Guest on December-01-2020
0

javascript generate random Hex

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

console.log(randomHex());
// Result: #92b008
Posted by: Guest on September-28-2021

Code answers related to "javascript generate random Hex"

Code answers related to "Javascript"

Browse Popular Code Answers by Language