function getcolor(n) {
var res = '#'
for (var j = 0; j < 6; j++) {
var idx = Math.floor(Math.random() * 16);
res += n[idx];
}
return res
}
var arr = [0,1,2,3,4,5,6,7,8,9,'a','b','c','d','e','f'];
console.log(getcolor(arr));
js随机一个颜色(16进制)
最新推荐文章于 2023-05-19 17:39:38 发布