You should use the ternary operator to set the textContent property of playingSong to currentTitle or “”.
please help know sure how to write this out tried a couple ways
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
currentTitle = (currentTitle) ? playingSong.textContent : "";
currentArtist = (currentArtist) ? "songArtist.textContent" : "";
// 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/128.0.0.0 Safari/537.36
Challenge Information:
Learn Basic String and Array Methods by Building a Music Player - Step 70
The top looks right but it is still giving me the (2. You should use the ternary operator to set the textContent property of playingSong to currentTitle or "" .) message.
This is my code
currentTitle = (currentTitle) ? playingSong.textContent : “”;
currentArtist = (currentArtist) ? songArtist.textContent : “”;
oh oops, now I see the issue.
You were not meant to set the ‘currentTitle’ or the ‘currentArtist’. Those are the values actually.
The things you were meant to set were the .textContent of the respective variables.
The left hand side of the assignment is correct now for one of the lines. You need to fix the right hand side. For the truthy condition, just follow the instructions given:
Use a ternary operator to check if currentTitle evaluates to a truthy value.
Edit: the second line of the code you last shared is correct.