I found this piece of the code online and I know its a function to generate random colors in JavaScript and I want to use it but I don't understand it completely. It'd be great if someone gave me an elaborated explanation.
function getRandomColor() {
var letters = '0123456789ABCDEF'.split('');
var color = '#';
for (var i = 0; i < 6; i++ ) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
Aucun commentaire:
Enregistrer un commentaire