i have been makign a code with javascript that run o. while i have made it run n : I have been making a java script code to show a traffic light that changes it image. it uses a set array but i am new to coding and have not been told how to do this. i have looked and made a code but it still not working. help. i can get it to run by clicking it but i need it to run without having to press a button lot of time.
so it changes image that are in the same folder as the code but now i don't know why it will not work. i have been task to do it so a person only has to press the button one time.help... 



    `<!DOCTYPE html>
    <html>
    <body>

    <h1>JavaScript Task 4</h1>

    <p> traffic light task for A452</p>

    <img id="light" src="traffitlr.jpeg">

    <button type="button" onclick="changeLights()">changelights(and Start Lights)</button>
    <button type="button" onclick=setinterval(change,1000)>start auto cycle</button>
    <script>
    var list = [
        "traffitlg.jpg",
        "traffitla.jpg",
        "traffitlr.jpg",
        "traffitly.jpg"
    ];


    var index = 0;

    function changeLights() {
        index = index + 1;

        if (index == list.length) index = 0;

        var image = document.getElementById('light');
        image.src=list[index];
    }





    </script>
    </body>
    </html> `