Function for random Hexadecimal color

PHOTO EMBED

Sun Aug 11 2024 21:31:08 GMT+0000 (Coordinated Universal Time)

Saved by @destinyChuck #json #vscode

function changeColor() {
    
    const randomColor = Math.floor(Math.random() * 16777215).toString(16);

    if (document.body.style.backgroundColor !== 'black') {
        document.body.style.backgroundColor = randomColor;
    }
    
    document.body.style.backgroundColor = '#' + randomColor;
    console.log(randomColor);
}
content_copyCOPY