+ 1

How can i randomize this change of background?

How can I change the background color randomly one after one with one click? https://code.sololearn.com/WpqAsmz7skZ5/?ref=app

6th Feb 2018, 9:25 AM
Rocky
Rocky - avatar
2 Answers
6th Feb 2018, 10:47 AM
wout werkman
wout werkman - avatar
+ 2
function getRandomColor() { var letters = '0123456789ABCDEF'; var color = '#'; for (var i = 0; i < 6; i++) { color += letters[Math.floor(Math.random() * 16)]; } return color; } use this function from stack over flow
6th Feb 2018, 9:49 AM
Abdurrahman Abulgasim
Abdurrahman Abulgasim - avatar