Tell us what’s happening:
Step 61
What do you mean by ternary operator?
Your code so far
// display current song title and artist
const setPlayerDisplay = () => {
const playingSong = document.getElementById("player-song-title");
const songArtist = document.getElementById("player-song-artist");
const currentTitle = userData?.currentSong?.title;
const currentArtist = userData?.currentSong?.artist;
if (currentTitle) {
playingSong.textContent = currentTitle;
} else {
playingSong.textContent = "";
}
if (currentArtist) {
songArtist.textContent = currentArtist;
} else {
songArtist.textContent = "";
}
};
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Challenge Information:
Learn Basic String and Array Methods by Building a Music Player - Step 61