Recently, I've been working with javaScript and I encountered some issues while writing a function. Strangely, I kept receiving error messages that I couldn't quite understand. Initially, there was a problem where every time I tried to create a js file named script.js, it would automatically change to script.ts. Eventually, I did manage to successfully create the script.js file, but now I'm feeling completely lost. I came across some discussions mentioning similar errors in TypeScript, but I assure you, I am using JavaScript for this project. Here is the snippet of code causing trouble:
function loadSong(song){
title.innerText = song;
audio.src = `music/${song}.mp3`;
cover.src = `img/${song}.jpg`;
}
The errors are happening on innerText
and src
. Any suggestions or assistance would be greatly appreciated.