Tell us what’s happening: I am not quite getting this step, I keep getting errors. Please help.
textContent
sets the text of a node and allows you to set or retrieve the text content of an HTML element.
<div id="example">This is some text content</div>
const element = document.getElementById('example');
console.log(element.textContent); // Output: This is some text content
Use a ternary operator to check if currentTitle
evaluates to a truthy value. If it does, set playingSong.textContent
to currentTitle
. Otherwise, set it to an empty string.
Then below that, use a ternary
operator to check if currentArtist
is truthy. If so, set songArtist.textContent
to currentArtist
. Otherwise, set it to empty string.
Your code so far
currentTitle ? playingSong.textContent = currentTitle : playingSong.textContent = "";
currentArtist ? songArtist.textContent = currentArtist : 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 64