Hello everyone I'm doing this music player and this is the song loader but the problem is that when I try to assing the value to song constant with lookSongbyId
function it returns me an error idk why
let queue = [
{
id: 1,
name: 'Crush',
artist: 'Glades',
}
]
const loadSong = (id) =>{
function lookSongbyId(id)
{
queue.forEach(currentSong => {
if(currentSong.id == id )
{
return currentSong
}
})
}
const song = lookSongbyId(id)
console.log(`la canción ${song.name} ha sido cargada`)
}
loadSong(1)
song
constant is undefined, and I dont know why aghhh
If u could help me with this code I've been so thankful with u :DDD