<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div class="background-wrapper">
<img class="background" src="https://picsum.photos/300/100?1"/>
</div>
</body>
</html>
let getImg = document.querySelector('.background');
let backgroundArrayImg = [
'https://picsum.photos/300/100?1', 'https://picsum.photos/300/100?2', 'https://picsum.photos/300/100?3'
];
let count = 1;
getImg.addEventListener('click', () => {
if(count === backgroundArrayImg.length){
count = 0;
}
else{
getImg.src = backgroundArrayImg[count];
count++;
}
})