Learn Basic String and Array Methods by Building a Music Player - Step 64

Tell us what’s happening:

When i test in the preview window it works just fine ( i added setPlayerDisplay() to playSong() to run some tests), but i keep gettin’ this console errors : "You should use the ternary operator to set the textContent property of playingSong to currentTitle or "" . " and with the songArtist too. Is it some bug with code camp or am i missing something ? why does it work on preview?

Your code so far

currentTitle ? playingSong.textContent = currentTitle : playingSong.textContent = “”;

currentArtist ? songArtist.textContent = songArtist : currentArtist.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 OPR/107.0.0.0

Challenge Information:

Learn Basic String and Array Methods by Building a Music Player - Step 64

You used the ternary operator the right way, but there is something that is not in the right place.

for exmple, you can use a ternary operator to set a variable to have boolean based on a condition:

const greaterThanFive = 6 > 5 ? true : false;

Hint: You are using the ternary operator to set a value of something which means that you need to use it on the left side of the = sign.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.