in spotifyclone we add an event listener to next and previous when we click default folder it work proper but other folder this throw error
previous.addEventListener(“click”,()=>{ currentSong.pause() console.log(“previous was clicked”) let index = ganas.indexOf(currentSong.src.split(“/”).slice(-1)[0]) if((index-1) >= 0){ playMusic(ganas[index-1]) } }) Uncaught TypeError: Cannot read properties of undefined (reading ‘indexOf’) at HTMLImageElement.<anonymous> (revis.js:152:27) plese help in solving error addeventlistener New contributor PRohit Mishra is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out […]
I ask for help in correcting an error Cannot read properties of null (reading ‘addEventListener’) in the code: [closed]
Closed 19 secs ago.
Hello! Why I get “Uncaught TypeError: Cannot read properties of null (reading ‘addEventListener’)”?
It is my code: