1const randomHex = () => `#${Math.floor(Math.random() * 0xffffff).toString(16).padEnd(6, "0")}`;
2
3console.log(randomHex());
4// Result: #92b008
5
1const genRanHex = size => [...Array(size)].map(() => Math.floor(Math.random() * 16).toString(16)).join('');
2
3console.log(genRanHex(6));
4console.log(genRanHex(12));
5console.log(genRanHex(3));