Files
30-seconds-of-code/test/randomHexColorCode/randomHexColorCode.js
2018-02-04 17:38:39 +02:00

5 lines
160 B
JavaScript

const randomHexColorCode = () => {
let n = (Math.random() * 0xfffff * 1000000).toString(16);
return '#' + n.slice(0, 6);
};
module.exports = randomHexColorCode;