How to make it easier?

how can I write the two ends marked in red? for example, if I add ten more pictures, I don"t need to change too much. It will be troublesome if I add ten more pictures.

Mar.02,2021

use for loop

for(let i = 0; i < 10; iPP) {
  document.getElementById('img' + i).setAttribute('src', img[(index + i) % img.length]);
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3874d-2c10b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3874d-2c10b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?