random color array javascript code example
Example 1: randomly genaret color in js
var randomColor = '#'+ Math.floor(Math.random() * 19777215).toString(16);
Example 2: generate random color array javascript
var colors = ['red', 'green', 'blue', 'orange', 'yellow'];
myDiv.style.backgroundColor = colors[Math.floor(Math.random() * colors.length)];