Hi, so I wanted to do a little tweak by creating a new file for the allSongs array and exporting it from there. But whenever I click on the songs displayed, the music doesn’t start playing. It only starts playing when I click the playButton button. So overall the buttons seem to work, but not when I click on the songs directly. What I have tried so far:
create a new file for the allSongs array => allSongs.js
export the allSongs array from there
import allSongs array in the script.js file
in index.html <script defer type="module" src="./script.js"></script> <script defer type="module" src="./allSongs.js"></script>
if I remove the defer and the type from the script and place the allSongs array in the script.js without exporting it, it works. It seems to be a problem with the type module.
Any help is appreciated.
Hi, i tried wrapping both the argument of the deleteSong and playSong functions within quotes and i still got the same undefined problem.
I find out that the html event attributes don’t work using js6 modules, so the function needed to be brought from global scope to module scope.
In the final step of Building Music Player, for me it’s showing this instructions:
With everything set in place, call the pauseSong(), setPlayerDisplay(), highlightCurrentSong(), and setPlayButtonAccessibleText() functions to correctly update the player. @humbleton
Yes i know, i just wanted to place the allSongs array into a new file instead of having it all in the same script.js file for the code structure. Sorry for the title