Please help!! forever grateful to the universe with traffic light code : **I LOVE YOU** Below is my code... it works perfectly fine but...


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <body>
        <img id="trafficlights" src="Redlight.jpeg" style="width:128px;height:128px;">
        <button type="button" onclick="changetrafficlights()">Change Traffic Lights</button>
    <script>
        var position = 0;
        var list = ["Redlight.jpeg","RedAmberlight.jpeg","Greenlight.jpeg", "Amberlight.jpeg"];  
        
        function changetrafficlights() 
            {position = position + 1;    
            if(position == list.length){
                position = 0;
            }
            var image = document.getElementById('trafficlights');
            image.src=list[position];}
    </script>
    </body>
    </html>


**hey, im trying to make a javascript code in which will use a while loop or for loop in which will go through the variable "list" automatically... please help!!!!!** 
