在下面的代码中,字符串'rgb'意味着什么?我不明白为什么这是必要的。
function randomColors() {
var red = Math.floor(Math.random() * 256);
var green = Math.floor(Math.random() * 256);
var blue = Math.floor(Math.random() * 256);
var colors = 'rgb(' + red + ',' + green + ',' + blue + ')';
return colors;
}
答案 0 :(得分:0)
这是CSS颜色的语法:
.someClass {
background-color: rgb(255, 255, 255);
}
看起来你的函数是为了返回一个css颜色声明。