Creation of Something Crazy

 const htmlBody = document.querySelector('body');

const randonClickFunction = function() {


    const colors = ["#002942", "#ff34ef", "red", "blue", "green", "purple", "gray"];


    const randomIndex = Math.floor(Math.random() * colors.length);


    const randomcolor = colors[randomIndex];


    htmlBody.style.background = randomcolor;


    console.log('The user clicked and set the color to' + randomcolor);

}

htmlBody.onclick = randonClickFunction;

Comments

Popular posts from this blog

Image Card (Sample)

Code Challenge by Peter Rocker!