Tell us what’s happening:
I don’t understand what’s wrong with my code. Can anybody explain it to me please?
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
playingSong.textContent = (currentTitle) ? currentTitle : “”;
songArtist.textContent = (currentArtist) ? currentArtist : “”;
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Challenge Information:
Learn Basic String and Array Methods by Building a Music Player - Step 70
You have some unnecessary brackets there
1 Like
playingSong.textContent = currentTitle ? currentTitle : “”;
songArtist.textContent = currentArtist ? currentArtist : “”;
Like this?
It’s still not working.
Delete and retype your ""
they are the wrong kind
I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>
) to add backticks around text.
See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').
1 Like
This was helpful i didn’t use the assignment operator before tin my code and alse use the currentTitle and currentArtist before my ternary operator . thanks for the insight