📜  généré une couleur aléatoire - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:59.054000             🧑  作者: Mango

代码示例1
const generateColor = () => {
  
    let randomColor = (Math.floor(Math.random()*0xFFFFFF)).toString(16);
    document.body.style.backgroundColor = "#" + randomColor;
    let text = document.querySelector('#code');
    text.innerText = "#" + randomColor;
  
}