Could you please help me figure out how to extract the value of AllMainSongsIndex
from the loop and demonstrate its usage?
songsItems.forEach((element, i) => {
let Allcovers = element.querySelectorAll(".cover")
Allcovers[0].src = songs[i].coversPath
let AllNames = element.getElementsByClassName("Names");
AllNames[0].innerHTML = songs[i].songName;
let AllMainSongsIndex=element.querySelector(".currentsoundGIF").id;
return AllMainSongsIndex;
});
Thank you in advance for your assistance.