I've been having problems recently with a piece of code that I have been working on. I am asked to create an array and cycle through the traffic lights with a button, this is what I have done:

```
<!DOCTYPE html>
<html>

<head>
<title> Traffic Lights </title>
</head>

<body>

<script>
whatPosition=1;
var images=["redlight.gif","redandamber.gif","greenlight.gif","amberlight.gif"];
function changeImage() {

if (whatPosition==0) {
document.getElementById("image").innerHTML=images[1];
whatPosition=1;

} 

else if (whatPosition==1){
document.getElementById("image").innerHTML=images[2]
whatPosition=2;
alert("I am an alert box!");
}
else if (whatPosition==2){
document.getElementById("image").innerHTML=images[3]
whatPosition=3;
}
else if (whatPosition==3){
document.getElementById("image").innerHTML=images[4]
whatPosition=4;
}
else if (whatPosition==4){
document.getElementById("image").innerHTML=images[0]
whatPosition=0;

```