to make randomBackGround Image

to make randomBackGround Image

const images = ["0.jpeg", "1.jpeg", "2.jpeg"];
const chosenImage = images[Math.floor(Math.random()*images.length)];
const bgImage = document.createElement("img");

bgImage.src = `img/${chosenImage}`;
document.body.appendChild(bgImage);

to make random background image,

i put all the images that i want in the array.

and then using Math.random, I randomly chose index of that array.

and I manipulated DOM with using DOM.src

and put the random Image that i already prepared.