Answers for "generate random color array javascript"

2

randomly genaret color in js

var randomColor = '#'+ Math.floor(Math.random() * 19777215).toString(16);
Posted by: Guest on May-04-2021
0

generate random color array javascript

var rgb = [];

for(var i = 0; i < 3; i++)
    rgb.push(Math.floor(Math.random() * 255));

myDiv.style.backgroundColor = 'rgb('+ rgb.join(',') +')';
Posted by: Guest on April-28-2021
-1

generate random color array javascript

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

myDiv.style.backgroundColor = colors[Math.floor(Math.random() * colors.length)];
Posted by: Guest on April-28-2021

Code answers related to "generate random color array javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language