Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

generate random color array javascript

var colors = ['red', 'green', 'blue', 'orange', 'yellow'];

myDiv.style.backgroundColor = colors[Math.floor(Math.random() * colors.length)];
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #generate #random #color #array #javascript
ADD COMMENT
Topic
Name
1+6 =