function randomRgb() { let r = Math.floor(Math.random() * 256) let g = Math.floor(Math.random() * 256) let b = Math.floor(Math.random() * 256) let rgb = 'rgb(' + r + ',' + g + ',' + b + ')' return rgb } console.log(randomRgb()) function randomHex() { var hex = parseInt(Math.random() * 0xFFFFFF).toString(16) return '#' + hex } console.log(randomHex())