HTML:
<!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>Computer God</title>
<link rel="stylesheet" href="pagStyle.css">
<link rel="stylesheet" href="pag.js">
</head>
<body>
<h1 class="Texto">Computer God.</h1>
<button type="button" class="Button" autofocus onclick="changeColor()" >Color</button>
<script src="pag.js"></script>
</body>
</html>
JS:
const body = document.querySelector('body')
function changeColor() {
let bgColor = body.style.backgroundColor = "#FFFA00"
}
basicamente eu tenho um "button" pra mudar o background-color da página a cada click. Esse código muda da cor padrão para amarela. Porém o resultado que eu desejo é : ter x cores e a cada clique no button alterne entre essas x cores. Como posso fazer isso ?