1var randomColor = '#'+ Math.floor(Math.random() * 19777215).toString(16);
1var rgb = [];
2
3for(var i = 0; i < 3; i++)
4 rgb.push(Math.floor(Math.random() * 255));
5
6myDiv.style.backgroundColor = 'rgb('+ rgb.join(',') +')';
7
1var colors = ['red', 'green', 'blue', 'orange', 'yellow'];
2
3myDiv.style.backgroundColor = colors[Math.floor(Math.random() * colors.length)];
4