This program is supposed to change the background color of the HTML body from a given array of colors. But the colors are not appearing as it should?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>I Can Click A Rainbow</title>
</head>
<body>
<button id="button">click me</button>
<script src="js/script.js"></script>
</body>
</html>
var button = document.getElementById("button");
var rainbow = ["red", "orange", "green", "blue", "indigo", "violet"];
function change() {
"use strict";
document.body.style.background = rainbow[Math.floor(7 * Math.random())];
}
button.addEventListener("click change");