is that my current code is a little verbose, how can I change it so that I can add pictures in the future, but there is no need to change the code. I probably know how to use length, but I don"t know how to do it
.var imgs = ["1.jpgrecords," 2.jpgrecords recorder 3.jpg"];
// 
var index = 0;
function setImage(imgCount){
    index += imgCount;
    if (index > imgs.length) {
          index = imgs.length;
    return;
    }
if (index < 0) {
        index = 0;
    return;
}
      
document.getElementById("img1").setAttribute("src", imgs[(index) % 3]);
document.getElementById("img2").setAttribute("src", imgs[(index + 1) % 3]);
document.getElementById("img3").setAttribute("src", imgs[(index + 2) % 3]);} 
 function myFunction () 
 {
