<div></div>
<button id="change">Change color</button>
div{
width: 50px;
height: 50px;
background: red;
margin-bottom: 10px;
}
const colors = ['red', 'green', 'blue'],
div = document.querySelector('div');
let i = 0;
change.onclick = () => div.style.background = colors[++i % colors.length];